Skip to content

Commit

Permalink
- Fix missing prototypes in the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Dec 11, 2020
1 parent e1c6788 commit 811cf6d
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 13 deletions.
6 changes: 5 additions & 1 deletion dnstap/unbound-dnstap-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ static ssize_t tap_receive(struct tap_data* data, void* buf, size_t len)
}

/** delete the tap structure */
void tap_data_free(struct tap_data* data)
static void tap_data_free(struct tap_data* data)
{
ub_event_del(data->ev);
ub_event_free(data->ev);
Expand Down Expand Up @@ -1355,6 +1355,10 @@ int main(int argc, char** argv)
struct tube;
struct query_info;
#include "util/data/packed_rrset.h"
#include "daemon/worker.h"
#include "daemon/remote.h"
#include "util/fptr_wlist.h"
#include "libunbound/context.h"

void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
Expand Down
1 change: 1 addition & 0 deletions doc/Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
missing prototype warnings.
- Merge PR #373 from fobser: Warning: arithmetic on a pointer to void
is a GNU extension.
- Fix missing prototypes in the code.

3 December 2020: Wouter
- make depend.
Expand Down
14 changes: 7 additions & 7 deletions dynlibmod/dynlibmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* module actions.
*/
#include "config.h"
#include "dynlibmod/dynlibmod.h"
#include "util/module.h"
#include "util/config_file.h"
#include "dynlibmod/dynlibmod.h"

#if HAVE_WINDOWS_H
#include <windows.h>
#define __DYNMOD HMODULE
#define __DYNSYM FARPROC
#define __LOADSYM GetProcAddress
void log_dlerror() {
static void log_dlerror() {
DWORD dwLastError = GetLastError();
LPSTR MessageBuffer;
DWORD dwBufferLength;
Expand All @@ -37,11 +37,11 @@ void log_dlerror() {

}

HMODULE open_library(const char* fname) {
static HMODULE open_library(const char* fname) {
return LoadLibrary(fname);
}

void close_library(const char* fname, __DYNMOD handle) {
static void close_library(const char* fname, __DYNMOD handle) {
(void)fname;
(void)handle;
}
Expand All @@ -50,15 +50,15 @@ void close_library(const char* fname, __DYNMOD handle) {
#define __DYNMOD void*
#define __DYNSYM void*
#define __LOADSYM dlsym
void log_dlerror() {
static void log_dlerror() {
log_err("dynlibmod: %s", dlerror());
}

void* open_library(const char* fname) {
static void* open_library(const char* fname) {
return dlopen(fname, RTLD_LAZY | RTLD_GLOBAL);
}

void close_library(const char* fname, __DYNMOD handle) {
static void close_library(const char* fname, __DYNMOD handle) {
if(!handle) return;
if(dlclose(handle) != 0) {
log_err("dlclose %s: %s", fname, strerror(errno));
Expand Down
3 changes: 3 additions & 0 deletions libunbound/libworker.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
#include "iterator/iter_hints.h"
#include "sldns/sbuffer.h"
#include "sldns/str2wire.h"
#ifdef USE_DNSTAP
#include "dnstap/dtstream.h"
#endif

#ifdef HAVE_TARGETCONDITIONALS_H
#include <TargetConditionals.h>
Expand Down
1 change: 1 addition & 0 deletions pythonmod/pythonmod_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* conversions.
*/
#include "config.h"
#include "pythonmod/pythonmod_utils.h"
#include "util/module.h"
#include "util/netevent.h"
#include "util/net_help.h"
Expand Down
3 changes: 2 additions & 1 deletion pythonmod/pythonmod_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include "util/module.h"
struct delegpt_addr;
struct sldns_buffer;

/**
* Store the reply_info and query_info pair in message cache (qstate->msg_cache)
Expand Down Expand Up @@ -77,7 +78,7 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
* @param pkt: a sldns_buffer which contains sldns_packet data
* @return 0 on failure, out of memory or parse error.
*/
int createResponse(struct module_qstate* qstate, sldns_buffer* pkt);
int createResponse(struct module_qstate* qstate, struct sldns_buffer* pkt);

/**
* Convert reply->addr to string
Expand Down
2 changes: 1 addition & 1 deletion services/listen_dnsport.c
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ void http2_req_stream_clear(struct http2_stream* h2_stream)
}
}

nghttp2_session_callbacks* http2_req_callbacks_create()
nghttp2_session_callbacks* http2_req_callbacks_create(void)
{
nghttp2_session_callbacks *callbacks;
if(nghttp2_session_callbacks_new(&callbacks) == NGHTTP2_ERR_NOMEM) {
Expand Down
2 changes: 1 addition & 1 deletion services/listen_dnsport.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ size_t http2_get_response_buffer_size(void);
* Create nghttp2 callbacks to handle HTTP2 requests.
* @return malloc'ed struct, NULL on failure
*/
nghttp2_session_callbacks* http2_req_callbacks_create();
nghttp2_session_callbacks* http2_req_callbacks_create(void);

/** Free http2 stream buffers and decrease buffer counters */
void http2_req_stream_clear(struct http2_stream* h2_stream);
Expand Down
3 changes: 3 additions & 0 deletions smallapp/worker_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#include "util/fptr_wlist.h"
#include "util/log.h"
#include "services/mesh.h"
#ifdef USE_DNSTAP
#include "dnstap/dtstream.h"
#endif

void worker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
uint8_t* ATTR_UNUSED(buffer), size_t ATTR_UNUSED(len),
Expand Down
1 change: 1 addition & 0 deletions testcode/fake_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "sldns/sbuffer.h"
#include "sldns/wire2str.h"
#include "sldns/str2wire.h"
#include "daemon/remote.h"
#include <signal.h>
struct worker;
struct daemon_remote;
Expand Down
16 changes: 14 additions & 2 deletions testcode/testbound.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,22 @@
#ifdef HAVE_TIME_H
# include <time.h>
#endif
#include <ctype.h>
#include "testcode/testpkts.h"
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "libunbound/worker.h"
#include "util/config_file.h"
#include "sldns/keyraw.h"
#include <ctype.h>
#ifdef UB_ON_WINDOWS
#include "winrc/win_svc.h"
#endif

/** signal that this is a testbound compile */
#define unbound_testbound 1
/** renamed main routine */
int daemon_main(int argc, char* argv[]);
/**
* include the main program from the unbound daemon.
* rename main to daemon_main to call it
Expand Down Expand Up @@ -333,7 +339,7 @@ setup_playback(const char* filename, int* pass_argc, char* pass_argv[])
}

/** remove config file at exit */
void remove_configfile(void)
static void remove_configfile(void)
{
struct config_strlist* p;
for(p=cfgfiles; p; p=p->next)
Expand Down Expand Up @@ -551,22 +557,28 @@ void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
log_assert(0);
}

#ifdef UB_ON_WINDOWS
void wsvc_command_option(const char* ATTR_UNUSED(wopt),
const char* ATTR_UNUSED(cfgfile), int ATTR_UNUSED(v),
int ATTR_UNUSED(c))
{
log_assert(0);
}
#endif

#ifdef UB_ON_WINDOWS
void wsvc_setup_worker(struct worker* ATTR_UNUSED(worker))
{
/* do nothing */
}
#endif

#ifdef UB_ON_WINDOWS
void wsvc_desetup_worker(struct worker* ATTR_UNUSED(worker))
{
/* do nothing */
}
#endif

#ifdef UB_ON_WINDOWS
void worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev),
Expand Down

0 comments on commit 811cf6d

Please sign in to comment.