C99 Compliance #29

Merged
jordan merged 11 commits from c99 into master 2024-01-13 22:13:46 +00:00
4 changed files with 12 additions and 12 deletions
Showing only changes of commit bc54f0ebfb - Show all commits

7
configure vendored
View file

@ -19,7 +19,7 @@ CFLAGS="-O1 -D_DEFAULT_SOURCE -I${INCLUDE}"
LIBS="-lm -lpthread"
# Default args for all platforms.
SCRIPT_ARGS="--prefix=/usr/local --lib-name=Cytoplasm --lib-version=0.4.1"
SCRIPT_ARGS="--prefix=/usr/local --lib-name=Cytoplasm"
# Set SSL flags depending on the platform.
case "$(uname)" in
@ -86,9 +86,6 @@ for arg in $SCRIPT_ARGS; do
--lib-name=*)
LIB_NAME=$(echo "$arg" | cut -d '=' -f 2-)
;;
--lib-version=*)
LIB_VERSION=$(echo "$arg" | cut -d '=' -f 2-)
;;
--enable-debug)
DEBUG="-O0 -g"
;;
@ -107,7 +104,7 @@ if [ -n "$TLS_IMPL" ]; then
LIBS="${LIBS} ${TLS_LIBS}"
fi
CFLAGS="${CFLAGS} '-DLIB_NAME=\"${LIB_NAME}\"' '-DLIB_VERSION=\"${LIB_VERSION}\"' ${DEBUG}"
CFLAGS="${CFLAGS} '-DLIB_NAME=\"${LIB_NAME}\"' ${DEBUG}"
LDFLAGS="${LIBS} ${LDFLAGS}"
#

View file

@ -33,13 +33,13 @@ CytoplasmGetVersion(void)
const char *
CytoplasmGetVersionStr(void)
{
#define S(x) #x
return "v" S(CYTOPLASM_VERSION_MAJOR) "." S(CYTOPLASM_VERSION_MINOR) "." S(CYTOPLASM_VERSION_PATCH)
return "v" STRINGIFY(CYTOPLASM_VERSION_MAJOR)
"." STRINGIFY(CYTOPLASM_VERSION_MINOR)
"." STRINGIFY(CYTOPLASM_VERSION_PATCH)
#if CYTOPLASM_VERSION_ALPHA
"-alpha" S(CYTOPLASM_VERSION_ALPHA)
"-alpha" STRINGIFY(CYTOPLASM_VERSION_ALPHA)
#elif CYTOPLASM_VERSION_BETA
"-beta" S(CYTOPLASM_VERSION_BETA)
"-beta" STRINGIFY(CYTOPLASM_VERSION_BETA)
#endif
;
#undef S
}

View file

@ -34,6 +34,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <Cytoplasm.h>
#include <Http.h>
#include <Memory.h>
#include <Util.h>
@ -154,7 +155,7 @@ HttpRequest(HttpRequestMethod method, int flags, unsigned short port, char *host
HttpRequestMethodToString(method), path);
HttpRequestHeader(context, "Connection", "close");
HttpRequestHeader(context, "User-Agent", LIB_NAME "/" LIB_VERSION);
HttpRequestHeader(context, "User-Agent", LIB_NAME "/" STRINGIFY(CYTOPLASM_VERSION));
HttpRequestHeader(context, "Host", host);
return context;

View file

@ -29,10 +29,12 @@
#define CYTOPLASM_VERSION_PATCH 1
#define CYTOPLASM_VERSION ((CYTOPLASM_VERSION_MAJOR * 10000) + (CYTOPLASM_VERSION_MINOR * 100) + (CYTOPLASM_VERSION_PATCH))
#define CYTOPLASM_VERSION_ALPHA 0
#define CYTOPLASM_VERSION_ALPHA 1
#define CYTOPLASM_VERSION_BETA 0
#define CYTOPLASM_VERSION_STABLE (!CYTOPLASM_VERSION_ALPHA && !CYTOPLASM_VERSION_BETA)
#define STRINGIFY(x) #x
/***
* @Nm Cytoplasm
* @Nd A simple API that provides metadata on the library itself.