"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/util.h" (21 Feb 2022, 1331 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "util.h" see the Fossies "Dox" file reference documentation.

    1 #include "config.h"
    2 
    3 /* fast-enough functions for uriencoding strings. */
    4 void uriencode_init(void);
    5 bool uriencode(const char *src, char *dst, const size_t srclen, const size_t dstlen);
    6 
    7 /*
    8  * Wrappers around strtoull/strtoll that are safer and easier to
    9  * use.  For tests and assumptions, see internal_tests.c.
   10  *
   11  * str   a NULL-terminated base decimal 10 unsigned integer
   12  * out   out parameter, if conversion succeeded
   13  *
   14  * returns true if conversion succeeded.
   15  */
   16 bool safe_strtoull(const char *str, uint64_t *out);
   17 bool safe_strtoull_hex(const char *str, uint64_t *out);
   18 bool safe_strtoll(const char *str, int64_t *out);
   19 bool safe_strtoul(const char *str, uint32_t *out);
   20 bool safe_strtol(const char *str, int32_t *out);
   21 bool safe_strtod(const char *str, double *out);
   22 bool safe_strcpy(char *dst, const char *src, const size_t dstmax);
   23 bool safe_memcmp(const void *a, const void *b, size_t len);
   24 
   25 #ifndef HAVE_HTONLL
   26 extern uint64_t htonll(uint64_t);
   27 extern uint64_t ntohll(uint64_t);
   28 #endif
   29 
   30 #ifdef __GCC
   31 # define __gcc_attribute__ __attribute__
   32 #else
   33 # define __gcc_attribute__(x)
   34 #endif
   35 
   36 /**
   37  * Vararg variant of perror that makes for more useful error messages
   38  * when reporting with parameters.
   39  *
   40  * @param fmt a printf format
   41  */
   42 void vperror(const char *fmt, ...)
   43     __gcc_attribute__ ((format (printf, 1, 2)));