football
socket abstraction layer
Loading...
Searching...
No Matches
Functions | Variables
fb_utility.c File Reference

Football utility functions. More...

#include <config.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <memory.h>
#include <time.h>
#include <arpa/inet.h>
#include "fb_public.h"
#include "fb_service.h"

Functions

void fb_set_logging (int logtype, FB_LOGGING_FUNCTION func)
 Set logging level.
 
void fb_log_impl (const char *file, int line, const char *func, int level, const char *format,...)
 
const char * fb_connection_info (FB_CONNECTION *connection)
 
bool fb_expandcalloc (void **data, size_t *capacity, size_t newcapacity, size_t itemsize)
 calloc() with ability to expand the allocated data.
 
void fb_destroy_argv (char **argv)
 
int fb_create_argv (const char *commandline, char ***result)
 
int fb_create_argv_from_query_string (const char *query_string, char ***result_names, char ***result_values)
 

Variables

FB_LOGGING_FUNCTION fb_log = fb_log_impl
 

Detailed Description

Football utility functions.

Function Documentation

◆ fb_expandcalloc()

bool fb_expandcalloc ( void **  data,
size_t *  capacity,
size_t  newcapacity,
size_t  itemsize 
)

calloc() with ability to expand the allocated data.

Does nothing if the actual capacity meets or exceeds the requested capacity. When expansion occurs, the added elements are zeroed out.

Parameters
datathe allocation to expand. May be *NULL for initial allocation.
capacitythe capacity of the allocation, which may be adjusted by this call.
newcapacitythe desired capacity of the allocation.
itemsizethe size of data items in the allocation.
Returns
true on success, false on failure (existing allocation remains valid).

◆ fb_set_logging()

void fb_set_logging ( int  logtype,
FB_LOGGING_FUNCTION  func 
)

Set logging level.

Set which messages will be collected by the internal logging function, or provide an alternate logging function. When using a private logging function, logtype is not used.

Parameters
logtypea bitmask indicating which data to log.
funca logging function that replaces the default one.