C99 Compliance #29
18 changed files with 118 additions and 103 deletions
20
src/Array.c
20
src/Array.c
|
@ -38,12 +38,12 @@ struct Array
|
|||
size_t size; /* Elements actually filled */
|
||||
};
|
||||
|
||||
int
|
||||
bool
|
||||
ArrayAdd(Array * array, void *value)
|
||||
{
|
||||
if (!array)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return ArrayInsert(array, array->size, value);
|
||||
|
@ -122,14 +122,14 @@ ArrayGet(Array * array, size_t index)
|
|||
}
|
||||
|
||||
|
||||
extern int
|
||||
bool
|
||||
ArrayInsert(Array * array, size_t index, void *value)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!array || !value || index > array->size)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (array->size >= array->allocated)
|
||||
|
@ -145,7 +145,7 @@ ArrayInsert(Array * array, size_t index, void *value)
|
|||
if (!array->entries)
|
||||
{
|
||||
array->entries = tmp;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
array->allocated = newSize;
|
||||
|
@ -160,7 +160,7 @@ ArrayInsert(Array * array, size_t index, void *value)
|
|||
|
||||
array->entries[index] = value;
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void *
|
||||
|
@ -200,14 +200,14 @@ ArraySize(Array * array)
|
|||
return array->size;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
ArrayTrim(Array * array)
|
||||
{
|
||||
void **tmp;
|
||||
|
||||
if (!array)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp = array->entries;
|
||||
|
@ -218,10 +218,10 @@ ArrayTrim(Array * array)
|
|||
if (!array->entries)
|
||||
{
|
||||
array->entries = tmp;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -212,7 +212,7 @@ Base64Unpad(char *base64, size_t length)
|
|||
base64[length] = '\0';
|
||||
}
|
||||
|
||||
extern int
|
||||
bool
|
||||
Base64Pad(char **base64Ptr, size_t length)
|
||||
{
|
||||
char *tmp;
|
||||
|
@ -221,7 +221,7 @@ Base64Pad(char **base64Ptr, size_t length)
|
|||
|
||||
if (length % 4 == 0)
|
||||
{
|
||||
return length; /* Success: no padding needed */
|
||||
return true; /* Success: no padding needed */
|
||||
}
|
||||
|
||||
newSize = length + (4 - (length % 4));
|
||||
|
@ -229,7 +229,7 @@ Base64Pad(char **base64Ptr, size_t length)
|
|||
tmp = Realloc(*base64Ptr, newSize + 100);;
|
||||
if (!tmp)
|
||||
{
|
||||
return 0; /* Memory error */
|
||||
return false; /* Memory error */
|
||||
}
|
||||
*base64Ptr = tmp;
|
||||
|
||||
|
@ -240,5 +240,5 @@ Base64Pad(char **base64Ptr, size_t length)
|
|||
|
||||
(*base64Ptr)[newSize] = '\0';
|
||||
|
||||
return newSize;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,12 +24,22 @@
|
|||
|
||||
#include <Cytoplasm.h>
|
||||
|
||||
char *CytoplasmGetName(void)
|
||||
int
|
||||
CytoplasmGetVersion(void)
|
||||
{
|
||||
return LIB_NAME;
|
||||
return CYTOPLASM_VERSION;
|
||||
}
|
||||
|
||||
char *CytoplasmGetVersion(void)
|
||||
const char *
|
||||
CytoplasmGetVersionStr(void)
|
||||
{
|
||||
return LIB_VERSION;
|
||||
#define S(x) #x
|
||||
return "v" S(CYTOPLASM_VERSION_MAJOR) "." S(CYTOPLASM_VERSION_MINOR) "." S(CYTOPLASM_VERSION_PATCH)
|
||||
#if CYTOPLASM_VERSION_ALPHA
|
||||
"-alpha" S(CYTOPLASM_VERSION_ALPHA)
|
||||
#elif CYTOPLASM_VERSION_BETA
|
||||
"-beta" S(CYTOPLASM_VERSION_BETA)
|
||||
#endif
|
||||
;
|
||||
#undef S
|
||||
}
|
||||
|
|
38
src/Db.c
38
src/Db.c
|
@ -693,19 +693,19 @@ DbCreate(Db * db, size_t nArgs,...)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
DbDelete(Db * db, size_t nArgs,...)
|
||||
{
|
||||
va_list ap;
|
||||
Array *args;
|
||||
char *file;
|
||||
char *hash;
|
||||
int ret = 1;
|
||||
bool ret = true;
|
||||
DbRef *ref;
|
||||
|
||||
if (!db)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
va_start(ap, nArgs);
|
||||
|
@ -756,7 +756,7 @@ DbDelete(Db * db, size_t nArgs,...)
|
|||
|
||||
if (UtilLastModified(file))
|
||||
{
|
||||
ret = remove(file) == 0;
|
||||
ret = (remove(file) == 0);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&db->lock);
|
||||
|
@ -789,14 +789,14 @@ DbLock(Db * db, size_t nArgs,...)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
DbUnlock(Db * db, DbRef * ref)
|
||||
{
|
||||
int destroy;
|
||||
bool destroy;
|
||||
|
||||
if (!db || !ref)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
lseek(ref->fd, 0L, SEEK_SET);
|
||||
|
@ -805,7 +805,7 @@ DbUnlock(Db * db, DbRef * ref)
|
|||
pthread_mutex_unlock(&db->lock);
|
||||
Log(LOG_ERR, "Failed to truncate file on disk.");
|
||||
Log(LOG_ERR, "Error on fd %d: %s", ref->fd, strerror(errno));
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
JsonEncode(ref->json, ref->stream, JSON_DEFAULT);
|
||||
|
@ -826,18 +826,18 @@ DbUnlock(Db * db, DbRef * ref)
|
|||
* require some items to be evicted. */
|
||||
DbCacheEvict(db);
|
||||
|
||||
destroy = 0;
|
||||
destroy = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy = 1;
|
||||
destroy = true;
|
||||
}
|
||||
|
||||
Free(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy = 1;
|
||||
destroy = true;
|
||||
}
|
||||
|
||||
if (destroy)
|
||||
|
@ -849,16 +849,16 @@ DbUnlock(Db * db, DbRef * ref)
|
|||
}
|
||||
|
||||
pthread_mutex_unlock(&db->lock);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
DbExists(Db * db, size_t nArgs,...)
|
||||
{
|
||||
va_list ap;
|
||||
Array *args;
|
||||
char *file;
|
||||
int ret;
|
||||
bool ret;
|
||||
|
||||
va_start(ap, nArgs);
|
||||
args = ArrayFromVarArgs(nArgs, ap);
|
||||
|
@ -866,13 +866,13 @@ DbExists(Db * db, size_t nArgs,...)
|
|||
|
||||
if (!args)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&db->lock);
|
||||
|
||||
file = DbFileName(db, args);
|
||||
ret = UtilLastModified(file) != 0;
|
||||
ret = (UtilLastModified(file) != 0);
|
||||
|
||||
pthread_mutex_unlock(&db->lock);
|
||||
|
||||
|
@ -954,15 +954,15 @@ DbJson(DbRef * ref)
|
|||
return ref ? ref->json : NULL;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
DbJsonSet(DbRef * ref, HashMap * json)
|
||||
{
|
||||
if (!ref || !json)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
JsonFree(ref->json);
|
||||
ref->json = JsonDuplicate(json);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -247,12 +247,12 @@ HashMapGet(HashMap * map, const char *key)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
HashMapIterateReentrant(HashMap * map, char **key, void **value, size_t * i)
|
||||
{
|
||||
if (!map)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*i >= map->capacity)
|
||||
|
@ -260,7 +260,7 @@ HashMapIterateReentrant(HashMap * map, char **key, void **value, size_t * i)
|
|||
*i = 0;
|
||||
*key = NULL;
|
||||
*value = NULL;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (*i < map->capacity)
|
||||
|
@ -273,20 +273,20 @@ HashMapIterateReentrant(HashMap * map, char **key, void **value, size_t * i)
|
|||
{
|
||||
*key = bucket->key;
|
||||
*value = bucket->value;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
*i = 0;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
HashMapIterate(HashMap * map, char **key, void **value)
|
||||
{
|
||||
if (!map)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -143,7 +143,7 @@ HttpRouterFree(HttpRouter * router)
|
|||
Free(router);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
HttpRouterAdd(HttpRouter * router, char *regPath, HttpRouteFunc * exec)
|
||||
{
|
||||
RouteNode *node;
|
||||
|
@ -152,19 +152,19 @@ HttpRouterAdd(HttpRouter * router, char *regPath, HttpRouteFunc * exec)
|
|||
|
||||
if (!router || !regPath || !exec)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (StrEquals(regPath, "/"))
|
||||
{
|
||||
router->root->exec = exec;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
regPath = StrDuplicate(regPath);
|
||||
if (!regPath)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp = regPath;
|
||||
|
@ -187,10 +187,10 @@ HttpRouterAdd(HttpRouter * router, char *regPath, HttpRouteFunc * exec)
|
|||
|
||||
Free(regPath);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
||||
{
|
||||
RouteNode *node;
|
||||
|
@ -199,17 +199,17 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
|||
HttpRouteFunc *exec = NULL;
|
||||
Array *matches = NULL;
|
||||
size_t i;
|
||||
int retval;
|
||||
bool retval;
|
||||
|
||||
if (!router || !path)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
matches = ArrayCreate();
|
||||
if (!matches)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
node = router->root;
|
||||
|
@ -280,7 +280,7 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
|||
|
||||
if (!exec)
|
||||
{
|
||||
retval = 0;
|
||||
retval = false;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ HttpRouterRoute(HttpRouter * router, char *path, void *args, void **ret)
|
|||
exec(matches, args);
|
||||
}
|
||||
|
||||
retval = 1;
|
||||
retval = true;
|
||||
|
||||
finish:
|
||||
for (i = 0; i < ArraySize(matches); i++)
|
||||
|
|
|
@ -715,25 +715,25 @@ HttpServerEventThread(void *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
HttpServerStart(HttpServer * server)
|
||||
{
|
||||
if (!server)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (server->isRunning)
|
||||
{
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pthread_create(&server->socketThread, NULL, HttpServerEventThread, server) != 0)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
18
src/Queue.c
18
src/Queue.c
|
@ -75,39 +75,39 @@ QueueFree(Queue * q)
|
|||
Free(q);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
QueueFull(Queue * q)
|
||||
{
|
||||
if (!q)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((q->front == q->rear + 1) || (q->front == 0 && q->rear == q->size - 1));
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
QueueEmpty(Queue * q)
|
||||
{
|
||||
if (!q)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return q->front == q->size + 1;
|
||||
return (q->front == (q->size + 1));
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
QueuePush(Queue * q, void *element)
|
||||
{
|
||||
if (!q || !element)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (QueueFull(q))
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (q->front == q->size + 1)
|
||||
|
@ -126,7 +126,7 @@ QueuePush(Queue * q, void *element)
|
|||
|
||||
q->items[q->rear] = element;
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
|
@ -549,13 +549,13 @@ StreamSeek(Stream * stream, off_t offset, int whence)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
StreamEof(Stream * stream)
|
||||
{
|
||||
return stream && (stream->flags & STREAM_EOF);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
StreamError(Stream * stream)
|
||||
{
|
||||
return stream && (stream->flags & STREAM_ERR);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* The functions in this API operate on an array structure which is
|
||||
|
@ -98,7 +99,7 @@ extern void *ArrayGet(Array *, size_t);
|
|||
* This function returns a boolean value indicating whether or not it
|
||||
* suceeded.
|
||||
*/
|
||||
extern int ArrayInsert(Array *, size_t, void *);
|
||||
extern bool ArrayInsert(Array *, size_t, void *);
|
||||
|
||||
/**
|
||||
* Set the value at the specified index in the specified array to the
|
||||
|
@ -115,7 +116,7 @@ extern void *ArraySet(Array *, size_t, void *);
|
|||
* return value as
|
||||
* .Fn ArrayInsert .
|
||||
*/
|
||||
extern int ArrayAdd(Array *, void *);
|
||||
extern bool ArrayAdd(Array *, void *);
|
||||
|
||||
/**
|
||||
* Remove the element at the specified index from the specified array.
|
||||
|
@ -146,7 +147,7 @@ extern void ArraySort(Array *, int (*) (void *, void *));
|
|||
* .P
|
||||
* This is a relatively expensive operation. The array must first be
|
||||
* duplicated. Then it is sorted, then it is iterated from beginning
|
||||
* to end to remove duplicate entires. Note that the comparison
|
||||
* to end to remove duplicate entries. Note that the comparison
|
||||
* function is executed on each element at least twice.
|
||||
*/
|
||||
extern Array *ArrayUnique(Array *, int (*) (void *, void *));
|
||||
|
@ -167,7 +168,7 @@ extern Array *ArrayReverse(Array *);
|
|||
* array. This function is intended to be used by functions that return
|
||||
* relatively read-only arrays that will be long-lived.
|
||||
*/
|
||||
extern int ArrayTrim(Array *);
|
||||
extern bool ArrayTrim(Array *);
|
||||
|
||||
/**
|
||||
* Convert a variadic arguments list into an Array. In most cases, the
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* This function computes the amount of bytes needed to store a message
|
||||
|
@ -93,7 +94,7 @@ extern void
|
|||
* this means it will only fail if a bigger string is necessary, but it
|
||||
* could not be automatically allocated on the heap.
|
||||
*/
|
||||
extern int
|
||||
extern bool
|
||||
Base64Pad(char **, size_t);
|
||||
|
||||
#endif /* CYTOPLASM_BASE64_H */
|
||||
|
|
|
@ -24,6 +24,15 @@
|
|||
#ifndef CYTOPLASM_CYTOPLASM_H
|
||||
#define CYTOPLASM_CYTOPLASM_H
|
||||
|
||||
#define CYTOPLASM_VERSION_MAJOR 0
|
||||
#define CYTOPLASM_VERSION_MINOR 4
|
||||
#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_BETA 0
|
||||
#define CYTOPLASM_VERSION_STABLE (!CYTOPLASM_VERSION_ALPHA && !CYTOPLASM_VERSION_BETA)
|
||||
|
||||
/***
|
||||
* @Nm Cytoplasm
|
||||
* @Nd A simple API that provides metadata on the library itself.
|
||||
|
@ -34,18 +43,8 @@
|
|||
* currently loaded library.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Get the name that this library was compiled with. In most cases,
|
||||
* this will be hard-coded to "Cytoplasm", but it may differ if, for
|
||||
* some reason, there exists another ABI-compatible library that
|
||||
* wishes to report its name.
|
||||
*
|
||||
* This function really only exists because the information is
|
||||
* available along side of the version information so for
|
||||
* consistency, it made sense to include both.
|
||||
*/
|
||||
extern char * CytoplasmGetName(void);
|
||||
/** */
|
||||
extern int CytoplasmGetVersion(void);
|
||||
|
||||
/**
|
||||
* Get the library version. This will be useful mostly for printing
|
||||
|
@ -55,6 +54,6 @@ extern char * CytoplasmGetName(void);
|
|||
* This function returns a string, which should usually be able to be
|
||||
* parsed using sscanf() if absolutely necessary.
|
||||
*/
|
||||
extern char * CytoplasmGetVersion(void);
|
||||
extern const char * CytoplasmGetVersionStr(void);
|
||||
|
||||
#endif /* CYTOPLASM_CYTOPLASM_H */
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "HashMap.h"
|
||||
#include "Array.h"
|
||||
|
@ -113,7 +114,7 @@ extern DbRef * DbLock(Db *, size_t,...);
|
|||
* This function assumes the object is not locked, otherwise undefined
|
||||
* behavior will result.
|
||||
*/
|
||||
extern int DbDelete(Db *, size_t,...);
|
||||
extern bool DbDelete(Db *, size_t,...);
|
||||
|
||||
/**
|
||||
* Unlock an object and return it back to the database. This function
|
||||
|
@ -121,7 +122,7 @@ extern int DbDelete(Db *, size_t,...);
|
|||
* read cache; writes are always immediate to ensure data integrity in
|
||||
* the event of a system failure.
|
||||
*/
|
||||
extern int DbUnlock(Db *, DbRef *);
|
||||
extern bool DbUnlock(Db *, DbRef *);
|
||||
|
||||
/**
|
||||
* Check the existence of the given database object in a more efficient
|
||||
|
@ -130,7 +131,7 @@ extern int DbUnlock(Db *, DbRef *);
|
|||
* This function does not lock the object, nor does it load it into
|
||||
* memory if it exists.
|
||||
*/
|
||||
extern int DbExists(Db *, size_t,...);
|
||||
extern bool DbExists(Db *, size_t,...);
|
||||
|
||||
/**
|
||||
* List all of the objects at a given path. Unlike the other varargs
|
||||
|
@ -164,6 +165,6 @@ extern HashMap * DbJson(DbRef *);
|
|||
* replace it with new JSON. This is more efficient than duplicating
|
||||
* a separate object into the database reference.
|
||||
*/
|
||||
extern int DbJsonSet(DbRef *, HashMap *);
|
||||
extern bool DbJsonSet(DbRef *, HashMap *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -150,7 +150,7 @@ extern void * HashMapDelete(HashMap *, const char *);
|
|||
* insertions or deletions occur during the iteration. This
|
||||
* functionality has not been tested, and will likely not work.
|
||||
*/
|
||||
extern int HashMapIterate(HashMap *, char **, void **);
|
||||
extern bool HashMapIterate(HashMap *, char **, void **);
|
||||
|
||||
/**
|
||||
* A reentrant version of
|
||||
|
@ -163,7 +163,7 @@ extern int HashMapIterate(HashMap *, char **, void **);
|
|||
* .Pp
|
||||
* The cursor should be initialized to 0 at the start of iteration.
|
||||
*/
|
||||
extern int
|
||||
extern bool
|
||||
HashMapIterateReentrant(HashMap *, char **, void **, size_t *);
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,7 +74,7 @@ extern void HttpRouterFree(HttpRouter *);
|
|||
* .Pa /some/path/(.*)/parts
|
||||
* to work as one would expect.
|
||||
*/
|
||||
extern int HttpRouterAdd(HttpRouter *, char *, HttpRouteFunc *);
|
||||
extern bool HttpRouterAdd(HttpRouter *, char *, HttpRouteFunc *);
|
||||
|
||||
/**
|
||||
* Route the specified request path using the specified routing
|
||||
|
@ -86,6 +86,6 @@ extern int HttpRouterAdd(HttpRouter *, char *, HttpRouteFunc *);
|
|||
* how to handle, and the pointer to a void pointer is where the
|
||||
* route function's response will be placed.
|
||||
*/
|
||||
extern int HttpRouterRoute(HttpRouter *, char *, void *, void **);
|
||||
extern bool HttpRouterRoute(HttpRouter *, char *, void *, void **);
|
||||
|
||||
#endif /* CYTOPLASM_HTTPROUTER_H */
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Http.h"
|
||||
#include "HashMap.h"
|
||||
|
@ -133,7 +134,7 @@ extern void HttpServerFree(HttpServer *);
|
|||
* caller can continue working while the HTTP server is running in a
|
||||
* separate thread and managing a pool of threads to handle responses.
|
||||
*/
|
||||
extern int HttpServerStart(HttpServer *);
|
||||
extern bool HttpServerStart(HttpServer *);
|
||||
|
||||
/**
|
||||
* Typically, at some point after calling
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* These functions operate on a queue structure that is opaque to the
|
||||
|
@ -73,7 +74,7 @@ extern void QueueFree(Queue *);
|
|||
* value indicating whether or not the push succeeded. Pushing items
|
||||
* into the queue will fail if the queue is full.
|
||||
*/
|
||||
extern int QueuePush(Queue *, void *);
|
||||
extern bool QueuePush(Queue *, void *);
|
||||
|
||||
/**
|
||||
* Pop an element out of the queue. This function returns NULL if the
|
||||
|
@ -95,11 +96,11 @@ extern void * QueuePeek(Queue *);
|
|||
/**
|
||||
* Determine whether or not the queue is full.
|
||||
*/
|
||||
extern int QueueFull(Queue *);
|
||||
extern bool QueueFull(Queue *);
|
||||
|
||||
/**
|
||||
* Determine whether or not the queue is empty.
|
||||
*/
|
||||
extern int QueueEmpty(Queue *);
|
||||
extern bool QueueEmpty(Queue *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* An opaque structure analogous to C's FILE pointers.
|
||||
|
@ -173,7 +174,7 @@ extern off_t StreamSeek(Stream *, off_t, int);
|
|||
* .Xr feof 3
|
||||
* function.
|
||||
*/
|
||||
extern int StreamEof(Stream *);
|
||||
extern bool StreamEof(Stream *);
|
||||
|
||||
/**
|
||||
* Test the stream for an error condition, returning a boolean value
|
||||
|
@ -182,7 +183,7 @@ extern int StreamEof(Stream *);
|
|||
* .Xr ferror 3
|
||||
* function.
|
||||
*/
|
||||
extern int StreamError(Stream *);
|
||||
extern bool StreamError(Stream *);
|
||||
|
||||
/**
|
||||
* Clear the error condition associated with the given stream, allowing
|
||||
|
|
Loading…
Reference in a new issue