project_files/frontlib/util/util.h
changeset 7227 1c859f572d72
parent 7224 5143861c83bd
child 7230 240620f46dd7
equal deleted inserted replaced
7224:5143861c83bd 7227:1c859f572d72
    43  * Simple calloc wrapper that automatically logs an error if no memory
    43  * Simple calloc wrapper that automatically logs an error if no memory
    44  * is available. Otherwise behaves exactly like calloc.
    44  * is available. Otherwise behaves exactly like calloc.
    45  */
    45  */
    46 void *flib_calloc(size_t count, size_t elementsize);
    46 void *flib_calloc(size_t count, size_t elementsize);
    47 
    47 
       
    48 /**
       
    49  * Replace all non-alphanumeric and non-ascii bytes with escape
       
    50  * sequences in the form %XX. Does not modify the original string,
       
    51  * but returns a newly allocated one that must be free()d. Returns
       
    52  * null on failure or if null was passed as argument.
       
    53  *
       
    54  * This should work fine with all ASCII-based charsets including UTF-8.
       
    55  */
       
    56 char *flib_urlencode(const char *str);
       
    57 
       
    58 /**
       
    59  * Replace escape sequences of the form %XX with their byte values.
       
    60  * Does not modify the original string, but returns a newly allocated
       
    61  * one that must be free()d. Returns null on failure or if null was
       
    62  * passed as argument.
       
    63  */
       
    64 char *flib_urldecode(const char *str);
       
    65 
    48 #endif
    66 #endif