project_files/frontlib/util/util.h
changeset 7224 5143861c83bd
parent 7179 f84805e6df03
child 7227 1c859f572d72
equal deleted inserted replaced
7221:8d04e85ca204 7224:5143861c83bd
    11  * Returned buffer must be free()d
    11  * Returned buffer must be free()d
    12  */
    12  */
    13 char *flib_asprintf(const char *fmt, ...);
    13 char *flib_asprintf(const char *fmt, ...);
    14 
    14 
    15 /**
    15 /**
    16  * Exactly as flib_asprintf, but accepts va_args.
    16  * Exactly as flib_asprintf, but accepts a va_list.
    17  */
    17  */
    18 char *flib_vasprintf(const char *fmt, va_list args);
    18 char *flib_vasprintf(const char *fmt, va_list args);
    19 
    19 
    20 /**
    20 /**
    21  * Return a duplicate of the provided string, or NULL if an error
    21  * Return a duplicate of the provided string, or NULL if an error
    31  *
    31  *
    32  * Returned buffer must be free()d
    32  * Returned buffer must be free()d
    33  */
    33  */
    34 void *flib_bufdupnull(const void *buf, size_t size);
    34 void *flib_bufdupnull(const void *buf, size_t size);
    35 
    35 
       
    36 /**
       
    37  * Simple malloc wrapper that automatically logs an error if no memory
       
    38  * is available. Otherwise behaves exactly like malloc.
       
    39  */
       
    40 void *flib_malloc(size_t size);
       
    41 
       
    42 /**
       
    43  * Simple calloc wrapper that automatically logs an error if no memory
       
    44  * is available. Otherwise behaves exactly like calloc.
       
    45  */
       
    46 void *flib_calloc(size_t count, size_t elementsize);
       
    47 
    36 #endif
    48 #endif