Skip to content
Permalink
Browse files
Fix static definition madness
This is supposed to define functions as static only in non-debug builds.
In debug builds it's better not to have static functions to allow for
better tracing. Previously, not only static functions were affected, but
variables too.
  • Loading branch information
pp3345 committed May 2, 2014
1 parent b93438b commit 1805a9311010a74ea8f6ef02f8b325fef3c313ab
@@ -20,7 +20,7 @@ static PancakeAuthenticationConfiguration *PancakeAuthenticationConfigurations =
/* Global variable */
PancakeAuthenticationConfiguration *PancakeAuthenticationActiveConfiguration = NULL;

static UByte PancakeAuthenticationGroupConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationGroupConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config;

if(step == PANCAKE_CONFIGURATION_INIT) {
@@ -37,7 +37,7 @@ static UByte PancakeAuthenticationGroupConfiguration(UByte step, config_setting_
return 1;
}

static UByte PancakeAuthenticationNameConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationNameConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = (PancakeAuthenticationConfiguration*) setting->parent->hook;

if(step == PANCAKE_CONFIGURATION_INIT) {
@@ -52,7 +52,7 @@ static UByte PancakeAuthenticationNameConfiguration(UByte step, config_setting_t
return 1;
}

static UByte PancakeAuthenticationBackendConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationBackendConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = (PancakeAuthenticationConfiguration*) setting->parent->hook;

if(step == PANCAKE_CONFIGURATION_INIT) {
@@ -78,7 +78,7 @@ static UByte PancakeAuthenticationBackendConfiguration(UByte step, config_settin
return 1;
}

static UByte PancakeAuthenticationConfigurationConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationConfigurationConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = NULL;

if(step == PANCAKE_CONFIGURATION_INIT) {
@@ -16,7 +16,7 @@ PancakeModule PancakeAuthenticationFileModule = {
0
};

static UByte PancakeAuthenticationFileAuthenticate(PancakeAuthenticationConfiguration *config, void *client);
STATIC UByte PancakeAuthenticationFileAuthenticate(PancakeAuthenticationConfiguration *config, void *client);

static const UByte hex[17] = "0123456789abcdef";

@@ -29,7 +29,7 @@ static PancakeAuthenticationBackend PancakeAuthenticationFile = {
NULL
};

static UByte PancakeAuthenticationFileFileConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationFileFileConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = (PancakeAuthenticationConfiguration*) setting->parent->parent->hook;
PancakeAuthenticationFileData *data = (PancakeAuthenticationFileData*) config->backendData;

@@ -122,7 +122,7 @@ static UByte PancakeAuthenticationFileFileConfiguration(UByte step, config_setti
return 1;
}

static UByte PancakeAuthenticationEncryptionConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationEncryptionConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = (PancakeAuthenticationConfiguration*) setting->parent->parent->hook;
PancakeAuthenticationFileData *data = (PancakeAuthenticationFileData*) config->backendData;

@@ -161,7 +161,7 @@ static UByte PancakeAuthenticationEncryptionConfiguration(UByte step, config_set
return 1;
}

static UByte PancakeAuthenticationFileConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeAuthenticationFileConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeAuthenticationConfiguration *config = (PancakeAuthenticationConfiguration*) setting->parent->hook;

if(step == PANCAKE_CONFIGURATION_INIT) {
@@ -204,7 +204,7 @@ UByte PancakeAuthenticationFileInitialize() {
return 1;
}

static UByte PancakeAuthenticationFileAuthenticate(PancakeAuthenticationConfiguration *config, void *c) {
STATIC UByte PancakeAuthenticationFileAuthenticate(PancakeAuthenticationConfiguration *config, void *c) {
PancakeAuthenticationFileData *data = (PancakeAuthenticationFileData*) config->backendData;
PancakeAuthenticationFileUser *user = NULL;
PancakeAuthenticationUserPassword *client = (PancakeAuthenticationUserPassword*) c;
@@ -538,8 +538,8 @@ static PancakeHTTPOutputFilter *outputFilters = NULL;
static PancakeHTTPParserHook *parserHooks = NULL;

/* Forward declarations */
static void PancakeHTTPInitializeConnection(PancakeSocket *sock);
static void PancakeHTTPReadHeaderData(PancakeSocket *sock);
STATIC void PancakeHTTPInitializeConnection(PancakeSocket *sock);
STATIC void PancakeHTTPReadHeaderData(PancakeSocket *sock);

PANCAKE_API void PancakeHTTPRegisterContentServeBackend(PancakeHTTPContentServeBackend *backend) {
LL_APPEND(contentBackends, backend);
@@ -553,7 +553,7 @@ PANCAKE_API void PancakeHTTPRegisterParserHook(PancakeHTTPParserHook *hook) {
LL_APPEND(parserHooks, hook);
}

static UByte PancakeHTTPVirtualHostConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPVirtualHostConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
PancakeHTTPVirtualHost *vhost;

switch(step) {
@@ -591,7 +591,7 @@ static UByte PancakeHTTPVirtualHostConfiguration(UByte step, config_setting_t *s
return 1;
}

static UByte PancakeHTTPHostsConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPHostsConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
switch(step) {
case PANCAKE_CONFIGURATION_INIT: {
PancakeHTTPVirtualHost *vHost = (PancakeHTTPVirtualHost*) (*scope)->data;
@@ -625,7 +625,7 @@ static UByte PancakeHTTPHostsConfiguration(UByte step, config_setting_t *setting
return 1;
}

static UByte PancakeHTTPDefaultConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPDefaultConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
if(step == PANCAKE_CONFIGURATION_INIT && setting->value.ival == 1) {
if(PancakeHTTPDefaultVirtualHost) {
PancakeLoggerFormat(PANCAKE_LOGGER_ERROR, 0, "Another virtual host has already been set as default");
@@ -638,7 +638,7 @@ static UByte PancakeHTTPDefaultConfiguration(UByte step, config_setting_t *setti
return 1;
}

static UByte PancakeHTTPDocumentRootConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPDocumentRootConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
String *documentRoot;

switch(step) {
@@ -683,7 +683,7 @@ static UByte PancakeHTTPDocumentRootConfiguration(UByte step, config_setting_t *
return 1;
}

static UByte PancakeHTTPNetworkInterfaceConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPNetworkInterfaceConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
if(PancakeNetworkInterfaceConfiguration(step, setting, scope) && step == PANCAKE_CONFIGURATION_INIT) {
PancakeSocket *sock = (PancakeSocket*) setting->hook;

@@ -696,7 +696,7 @@ static UByte PancakeHTTPNetworkInterfaceConfiguration(UByte step, config_setting
return 0;
}

static UByte PancakeHTTPContentServeBackendConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPContentServeBackendConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
config_setting_t *element;
UInt16 i = 0;
PancakeHTTPVirtualHost *vHost = (PancakeHTTPVirtualHost*) setting->parent->hook;
@@ -730,7 +730,7 @@ static UByte PancakeHTTPContentServeBackendConfiguration(UByte step, config_sett
return 1;
}

static UByte PancakeHTTPOutputFilterConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPOutputFilterConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
config_setting_t *element;
UInt16 i = 0;
PancakeHTTPVirtualHost *vHost = (PancakeHTTPVirtualHost*) setting->parent->hook;
@@ -764,7 +764,7 @@ static UByte PancakeHTTPOutputFilterConfiguration(UByte step, config_setting_t *
return 1;
}

static UByte PancakeHTTPParserHookConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
STATIC UByte PancakeHTTPParserHookConfiguration(UByte step, config_setting_t *setting, PancakeConfigurationScope **scope) {
config_setting_t *element;
UInt16 i = 0;
PancakeHTTPVirtualHost *vHost = (PancakeHTTPVirtualHost*) setting->parent->hook;
@@ -798,11 +798,10 @@ static UByte PancakeHTTPParserHookConfiguration(UByte step, config_setting_t *se
return 1;
}

static UByte initDeferred = 0;

UByte PancakeHTTPInitialize() {
PancakeConfigurationGroup *group, *child;
PancakeConfigurationSetting *setting, *serverHeader;
static UByte initDeferred = 0;

if(!initDeferred) {
// Defer once to make sure all network layers are registered before creating interface group
@@ -865,7 +864,7 @@ UByte PancakeHTTPCheckConfiguration() {
return 1;
}

static inline void PancakeHTTPInitializeRequestStructure(PancakeHTTPRequest *request) {
STATIC inline void PancakeHTTPInitializeRequestStructure(PancakeHTTPRequest *request) {
request->method = 0;
request->headers = NULL;
request->answerHeaders = NULL;
@@ -886,7 +885,7 @@ static inline void PancakeHTTPInitializeRequestStructure(PancakeHTTPRequest *req
PancakeConfigurationInitializeScopeGroup(&request->scopeGroup);
}

static void PancakeHTTPInitializeConnection(PancakeSocket *sock) {
STATIC void PancakeHTTPInitializeConnection(PancakeSocket *sock) {
PancakeSocket *client = PancakeNetworkAcceptConnection(sock);
PancakeHTTPRequest *request;

@@ -907,7 +906,7 @@ static void PancakeHTTPInitializeConnection(PancakeSocket *sock) {
PancakeHTTPReadHeaderData(client);
}

static void PancakeHTTPInitializeKeepAliveConnection(PancakeSocket *sock) {
STATIC void PancakeHTTPInitializeKeepAliveConnection(PancakeSocket *sock) {
PancakeHTTPRequest *request;

request = PancakeAllocate(sizeof(PancakeHTTPRequest));
@@ -925,7 +924,7 @@ static void PancakeHTTPInitializeKeepAliveConnection(PancakeSocket *sock) {
PancakeHTTPReadHeaderData(sock);
}

static inline void PancakeHTTPCleanRequestData(PancakeHTTPRequest *request) {
STATIC inline void PancakeHTTPCleanRequestData(PancakeHTTPRequest *request) {
PancakeHTTPHeader *header, *tmp;

if(request->onRequestEnd) {
@@ -943,7 +942,7 @@ static inline void PancakeHTTPCleanRequestData(PancakeHTTPRequest *request) {
PancakeConfigurationDestroyScopeGroup(&request->scopeGroup);
}

static void PancakeHTTPOnClientTimeout(PancakeSocket *sock) {
STATIC void PancakeHTTPOnClientTimeout(PancakeSocket *sock) {
PancakeHTTPRequest *request = (PancakeHTTPRequest*) sock->data;

if(request != NULL) {
@@ -955,7 +954,7 @@ static void PancakeHTTPOnClientTimeout(PancakeSocket *sock) {
PancakeNetworkClose(sock);
}

static void PancakeHTTPReadHeaderData(PancakeSocket *sock) {
STATIC void PancakeHTTPReadHeaderData(PancakeSocket *sock) {
PancakeHTTPRequest *request = (PancakeHTTPRequest*) sock->data;

// Read data from socket
@@ -1460,7 +1459,7 @@ PANCAKE_API inline void PancakeHTTPOnRemoteHangup(PancakeSocket *sock) {
PancakeNetworkClose(sock);
}

static void PancakeHTTPOnKeepAliveRemoteHangup(PancakeSocket *sock) {
STATIC void PancakeHTTPOnKeepAliveRemoteHangup(PancakeSocket *sock) {
PancakeUnschedule((PancakeSchedulerEvent*) sock->data);
PancakeNetworkClose(sock);
}
@@ -2,8 +2,8 @@

#if defined(PANCAKE_HTTP) && defined(PANCAKE_NETWORK_TLS)

static UByte PancakeHTTPSInitialize(PancakeSocket *sock);
static String *PancakeHTTPSNextProtocolNegotiation(PancakeSocket *sock);
STATIC UByte PancakeHTTPSInitialize(PancakeSocket *sock);
STATIC String *PancakeHTTPSNextProtocolNegotiation(PancakeSocket *sock);

static PancakeNetworkTLSApplicationProtocol PancakeHTTPS = {
StaticString("HTTPS"),
@@ -19,13 +19,13 @@ static String http11 = {
sizeof("\x08http/1.1") - 1
};

static UByte PancakeHTTPSInitialize(PancakeSocket *sock) {
STATIC UByte PancakeHTTPSInitialize(PancakeSocket *sock) {
sock->flags |= PANCAKE_HTTPS;

return 1;
}

static String *PancakeHTTPSNextProtocolNegotiation(PancakeSocket *sock) {
STATIC String *PancakeHTTPSNextProtocolNegotiation(PancakeSocket *sock) {
return &http11;
}

@@ -9,7 +9,7 @@
#include "SharedDependencies/Base64Decode.h"

/* Forward declaration */
static UByte PancakeHTTPBasicAuthenticate(PancakeSocket *sock);
STATIC UByte PancakeHTTPBasicAuthenticate(PancakeSocket *sock);

PancakeModule PancakeHTTPBasicAuthenticationModule = {
"HTTPBasicAuthentication",
@@ -53,7 +53,7 @@ UByte PancakeHTTPBasicAuthenticationInitialize() {
return 1;
}

static UByte PancakeHTTPBasicAuthenticate(PancakeSocket *sock) {
STATIC UByte PancakeHTTPBasicAuthenticate(PancakeSocket *sock) {
// Check whether authentication framework is active
if(PancakeAuthenticationActiveConfiguration) {
PancakeHTTPRequest *request = (PancakeHTTPRequest*) sock->data;
@@ -6,9 +6,9 @@
#include "PancakeConfiguration.h"
#include "PancakeLogger.h"

static UByte PancakeHTTPDeflateChunk(PancakeSocket *sock, String *chunk);
static UByte PancakeHTTPDeflateInitialize();
static void PancakeHTTPDeflateOnOutputEnd(PancakeHTTPRequest *request);
STATIC UByte PancakeHTTPDeflateChunk(PancakeSocket *sock, String *chunk);
STATIC UByte PancakeHTTPDeflateInitialize();
STATIC void PancakeHTTPDeflateOnOutputEnd(PancakeHTTPRequest *request);

PancakeModule PancakeHTTPDeflate = {
"HTTPDeflate",
@@ -34,7 +34,7 @@ static String PancakeHTTPDeflateContentEncoding = {
sizeof("deflate") - 1
};

static UByte PancakeHTTPDeflateInitialize() {
STATIC UByte PancakeHTTPDeflateInitialize() {
PancakeConfigurationGroup *HTTP, *vHostGroup, *group;
PancakeConfigurationSetting *vHost;

@@ -60,12 +60,12 @@ static UByte PancakeHTTPDeflateInitialize() {
return 1;
}

static void PancakeHTTPDeflateOnOutputEnd(PancakeHTTPRequest *request) {
STATIC void PancakeHTTPDeflateOnOutputEnd(PancakeHTTPRequest *request) {
deflateEnd(request->outputFilterData);
PancakeFree(request->outputFilterData);
}

static UByte PancakeHTTPDeflateChunk(PancakeSocket *sock, String *chunk) {
STATIC UByte PancakeHTTPDeflateChunk(PancakeSocket *sock, String *chunk) {
PancakeHTTPRequest *request = (PancakeHTTPRequest*) sock->data;
z_streamp stream;
String output;

0 comments on commit 1805a93

Please sign in to comment.