Skip to content

Commit

Permalink
backend update to 23.04.000.199
Browse files Browse the repository at this point in the history
  • Loading branch information
“Martin committed Aug 23, 2023
1 parent 0be0c68 commit 8b7c308
Show file tree
Hide file tree
Showing 95 changed files with 2,959 additions and 1,477 deletions.
1 change: 0 additions & 1 deletion backend/src/c/bav/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# #
####################################################################################################################################################################################################################################################################
#

CFLAGS = -I. -I../lib -pthread
LDFLAGS = -L. -L../lib -pthread
LIBS = -lagn
Expand Down
2 changes: 1 addition & 1 deletion backend/src/c/bav/bav.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ find_locals (void) /*{{{*/
void *cfg;

rc = true;
if (cfg = systemconfig_alloc (NULL)) {
if (cfg = systemconfig_alloc ()) {
const char *value;
char *copy;

Expand Down
1 change: 0 additions & 1 deletion backend/src/c/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# #
####################################################################################################################################################################################################################################################################
#

CFLAGS = -I.
LDFLAGS = -L.
LIBS := -lagn -lparson
Expand Down
7 changes: 4 additions & 3 deletions backend/src/c/lib/agn.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ typedef unsigned long logmask_t;
/**
* All informations required for logging
*/
typedef struct idc idc_t;
typedef struct { /*{{{*/
int logfd; /**< file desc. to copy output to */
int slprio; /**< syslog priority */
Expand All @@ -275,7 +276,7 @@ typedef struct { /*{{{*/
long lastday; /**< dito for the day */
int diff; /**< TZ drift */
FILE *lfp; /**< filepointer to output file */
void *idc; /**< ID chain */
idc_t *idc; /**< ID chain */
bool_t slactive; /**< syslog is active */
buffer_t *obuf; /**< output buffer */
buffer_t *collect; /**< to collect all messages */
Expand Down Expand Up @@ -478,7 +479,7 @@ extern bool_t log_collect (log_t *l, int level);
extern void log_uncollect (log_t *l);
extern bool_t log_idset (log_t *l, const char *what);
extern void log_idclr (log_t *l);
extern bool_t log_idpush (log_t *l, const char *what, const char *separator);
extern bool_t log_idpush (log_t *l, const char *what);
extern void log_idpop (log_t *l);
extern void log_suspend_pop (log_t *l);
extern void log_suspend_push (log_t *l, unsigned long mask, bool_t set);
Expand Down Expand Up @@ -562,7 +563,7 @@ extern bool_t purl_set_anchor (purl_t *p, const byte_t *anchor);
extern const byte_t *purl_build (purl_t *p, const char *extra_encode, int *rlen, bool_t (*callback) (void *, buffer_t *, const byte_t *, int), void *priv);

extern void *systemconfig_free (void *lc);
extern void *systemconfig_alloc (const char *fname);
extern void *systemconfig_alloc (void);
extern const char *systemconfig_find (void *lc, const char *key);
extern bool_t systemconfig_get (void *lc, int idx, const char **key, const char **value);

Expand Down
27 changes: 18 additions & 9 deletions backend/src/c/lib/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,19 +730,28 @@ pool_flush (pool_t *p) /*{{{*/
buffer_t *
pool_request (pool_t *p, int nsize) /*{{{*/
{
buffer_t *b;
if (p -> root) {
buffer_t *b, *prev;

if (b = p -> root) {
p -> root = p -> root -> link;
for (b = p -> root, prev = NULL; b && b -> link; ) {
if ((b -> size < nsize) || ((b -> size >= nsize) && (b -> link -> size < nsize)))
break;
prev = b;
b = b -> link;
}
if (prev)
prev -> link = b -> link;
else
p -> root = b -> link;
b -> link = NULL;
buffer_clear (b);
buffer_size (b, nsize);
} else {
b = buffer_alloc (nsize);
if (b -> size < nsize) {
if (! buffer_size (b, nsize))
buffer_clear (b);
}
return b;
}
if (b && (! b -> valid))
buffer_clear (b);
return b;
return buffer_alloc (nsize);
}/*}}}*/
buffer_t *
pool_release (pool_t *p, buffer_t *b) /*{{{*/
Expand Down
72 changes: 34 additions & 38 deletions backend/src/c/lib/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,51 +28,48 @@
/** Stack for IDs.
* This stack is used to keep track of logging IDs.
*/
typedef struct idc { /*{{{*/
char *str; /**< concated ID string */
struct idc *next; /**< next element in stack */
struct idc { /*{{{*/
char *str; /**< concated ID string */
idc_t *next; /**< next element in stack */
/*}}}*/
} idc_t;
};
/** Frees an ID.
* @param i the ID to free
* @return NULL
*/
static idc_t *
idc_free (idc_t *i) /*{{{*/
{
if (i) {
if (i -> str)
free (i -> str);
free (i);
}
return NULL;
}/*}}}*/
/** Alloced ID.
* @param prefix the already stacked IDs
* @param str the new ID
* @param separator
* @return the new head of the stack on success, NULL otherwise
*/
static idc_t *
idc_alloc (idc_t *prefix, const char *str, const char *separator) /*{{{*/
idc_alloc (idc_t *prefix, const char *str) /*{{{*/
{
idc_t *i;

if (i = (idc_t *) malloc (sizeof (idc_t))) {
if (prefix) {
if (i -> str = malloc (strlen (prefix -> str) + strlen (str) + (separator ? strlen (separator) : 0) + 1))
sprintf (i -> str, "%s%s%s", prefix -> str, (separator ? separator : ""), str);
if (i -> str = malloc (strlen (prefix -> str) + strlen (str) + 3))
sprintf (i -> str, "%s->%s", prefix -> str, str);
} else
i -> str = strdup (str);
if (i -> str)
i -> next = NULL;
else {
free (i);
i = NULL;
}
else
i = idc_free (i);
}
return i;
}/*}}}*/
/** Frees an ID.
* @param i the ID to free
* @return NULL
*/
static idc_t *
idc_free (idc_t *i) /*{{{*/
{
if (i) {
if (i -> str)
free (i -> str);
free (i);
}
return NULL;
}/*}}}*/
/** Frees stack.
* @param i the ID to start from
* @return NULL
Expand Down Expand Up @@ -267,7 +264,7 @@ log_free (log_t *l) /*{{{*/
if (l -> lfp)
fclose (l -> lfp);
if (l -> idc)
idc_free_all ((idc_t *) l -> idc);
idc_free_all (l -> idc);
if (l -> obuf)
buffer_free (l -> obuf);
if (l -> collect)
Expand Down Expand Up @@ -353,7 +350,7 @@ log_path_set (log_t *l, const char *logpath) /*{{{*/
return (logpath && (! l -> logpath)) ? false : true;
}/*}}}*/
/** Sets default logging path.
* Sets the default logging path creating from enviroment variable
* Sets the default logging path creating from environment variable
* @param l the logger
* @return true on success, false otherwise
*/
Expand Down Expand Up @@ -460,7 +457,7 @@ bool_t
log_idset (log_t *l, const char *what) /*{{{*/
{
log_idclr (l);
l -> idc = idc_alloc (NULL, what, NULL);
l -> idc = idc_alloc (NULL, what);
return l -> idc ? true : false;
}/*}}}*/
/** Clears logging IDs.
Expand All @@ -471,24 +468,23 @@ void
log_idclr (log_t *l) /*{{{*/
{
if (l -> idc)
l -> idc = idc_free_all ((idc_t *) l -> idc);
l -> idc = idc_free_all (l -> idc);
}/*}}}*/
/** Push new logging ID.
* The new logging id <i>what</i> is pushed on top of the ID stack.
* If there is already one on the stack, the new ID is created using
* the stack value, concaternated by separator and new ID
* the stack value.
* @param l the logger
* @param what the new ID
* @param separator the separator for concaternation
* @return true on success, false otherwise
*/
bool_t
log_idpush (log_t *l, const char *what, const char *separator) /*{{{*/
log_idpush (log_t *l, const char *what) /*{{{*/
{
idc_t *tmp;

if (tmp = idc_alloc ((separator ? (idc_t *) l -> idc : NULL), what, separator)) {
tmp -> next = (idc_t *) l -> idc;
if (tmp = idc_alloc (l -> idc, what)) {
tmp -> next = l -> idc;
l -> idc = tmp;
}
return tmp ? true : false;
Expand All @@ -502,7 +498,7 @@ log_idpop (log_t *l) /*{{{*/
{
idc_t *tmp;

if (tmp = (idc_t *) l -> idc) {
if (tmp = l -> idc) {
l -> idc = tmp -> next;
idc_free (tmp);
}
Expand Down Expand Up @@ -684,7 +680,7 @@ log_mout (log_t *l, int level, logmask_t mask, const char *what, const char *fmt
bool_t
log_vidout (log_t *l, int level, logmask_t mask, const char *fmt, va_list par) /*{{{*/
{
return log_vmout (l, level, mask, (l -> idc ? ((idc_t *) l -> idc) -> str : NULL), fmt, par);
return log_vmout (l, level, mask, (l -> idc ? l -> idc -> str : NULL), fmt, par);
}/*}}}*/
/** Write to logfile.
* Same as <i>log_vidout</i> except that parameter are passed directly
Expand Down Expand Up @@ -747,7 +743,7 @@ log_slout (log_t *l, int level, logmask_t mask, int priority, const char *what,
bool_t
log_vout (log_t *l, int level, const char *fmt, va_list par) /*{{{*/
{
return log_vmout (l, level, 0, (l -> idc ? ((idc_t *) l -> idc) -> str : NULL), fmt, par);
return log_vmout (l, level, 0, l -> idc ? l -> idc -> str : NULL, fmt, par);
}/*}}}*/
/** Write to logfile.
* Same as <i>log_vout</i> except that parameter are passed directly
Expand Down
20 changes: 10 additions & 10 deletions backend/src/c/lib/systemconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ systemconfig_free (void *lc) /*{{{*/
return NULL;
}/*}}}*/
void *
systemconfig_alloc (const char *fname) /*{{{*/
systemconfig_alloc (void) /*{{{*/
{
config_t *c;

Expand Down Expand Up @@ -473,18 +473,18 @@ systemconfig_alloc (const char *fname) /*{{{*/
ok = false;
}
} else {
if (! fname) {
fname = getenv (PATH_CONFIG_ENV);
if (! fname) {
fname = PATH_CONFIG;
const char *filename;

filename = getenv (PATH_CONFIG_ENV);
if (! filename) {
filename = PATH_CONFIG;
# ifdef PATH_LEGACY
if (access (fname, R_OK) == -1) {
fname = PATH_LEGACY;
}
# endif
if ((access (filename, R_OK) == -1) && (access (PATH_LEGACY, R_OK) != -1)) {
filename = PATH_LEGACY;
}
# endif
}
if (! (c -> filename = strdup (fname))) {
if (! (c -> filename = strdup (filename))) {
ok = false;
} else {
ok = config_check (c);
Expand Down
3 changes: 2 additions & 1 deletion backend/src/c/lib/timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ timeout_init (void) /*{{{*/
timeout_release ();
timeout -> seconds = 0;
timeout -> start = 0;
return true;
}
return timeout ? true : false;
return false;
}/*}}}*/
void
timeout_release (void) /*{{{*/
Expand Down
23 changes: 0 additions & 23 deletions backend/src/c/lib/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,6 @@ xsubstr (const xchar_t *s, int start, int end) /*{{{*/
rc = NULL;
return rc;
}/*}}}*/
bool_t
xmlbuf_equal (xmlbuf_t *b1, xmlbuf_t *b2) /*{{{*/
{
if ((! b1) && (! b2))
return true;
if (b1 && b2 && (b1 -> length == b2 -> length) &&
((! b1 -> length) || (! memcmp (b1 -> buffer, b2 -> buffer, b1 -> length))))
return true;
return false;
}/*}}}*/
char *
xmlbuf_to_string (xmlbuf_t *b) /*{{{*/
{
return buffer_copystring ((buffer_t *) b);
}/*}}}*/
long
xmlbuf_to_long (xmlbuf_t *b) /*{{{*/
{
const char *s = b ? buffer_string (b) : NULL;

return s ? strtol (s, NULL, 0) : -1;
}/*}}}*/

static inline unsigned long
mkcp (const xchar_t *s, int *len) /*{{{*/
{
Expand Down
Loading

0 comments on commit 8b7c308

Please sign in to comment.