memcached  1.6.15
About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.
  Fossies Dox: memcached-1.6.15.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

util.c File Reference
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "memcached.h"
Include dependency graph for util.c:

Go to the source code of this file.

Macros

#define xisspace(c)   isspace((unsigned char)c)
 

Functions

void uriencode_init (void)
 
bool uriencode (const char *src, char *dst, const size_t srclen, const size_t dstlen)
 
bool safe_strtoull (const char *str, uint64_t *out)
 
bool safe_strtoull_hex (const char *str, uint64_t *out)
 
bool safe_strtoll (const char *str, int64_t *out)
 
bool safe_strtoul (const char *str, uint32_t *out)
 
bool safe_strtol (const char *str, int32_t *out)
 
bool safe_strtod (const char *str, double *out)
 
bool safe_strcpy (char *dst, const char *src, const size_t dstmax)
 
bool safe_memcmp (const void *a, const void *b, size_t len)
 
void vperror (const char *fmt,...)
 
static uint64_t mc_swap64 (uint64_t in)
 
uint64_t ntohll (uint64_t val)
 
uint64_t htonll (uint64_t val)
 

Variables

static char * uriencode_map [256]
 
static char uriencode_str [768]
 

Macro Definition Documentation

◆ xisspace

#define xisspace (   c)    isspace((unsigned char)c)

Definition at line 47 of file util.c.

Function Documentation

◆ htonll()

uint64_t htonll ( uint64_t  val)

Definition at line 261 of file util.c.

References mc_swap64().

Referenced by add_bin_header(), arithmetic_command(), complete_incr_bin(), and process_bin_get_or_touch().

◆ mc_swap64()

static uint64_t mc_swap64 ( uint64_t  in)
static

Definition at line 240 of file util.c.

Referenced by htonll(), and ntohll().

◆ ntohll()

uint64_t ntohll ( uint64_t  val)

◆ safe_memcmp()

bool safe_memcmp ( const void a,
const void b,
size_t  len 
)

Definition at line 206 of file util.c.

Referenced by authfile_check().

◆ safe_strcpy()

bool safe_strcpy ( char *  dst,
const char *  src,
const size_t  dstmax 
)

Definition at line 190 of file util.c.

Referenced by restart_register().

◆ safe_strtod()

bool safe_strtod ( const char *  str,
double *  out 
)

Definition at line 167 of file util.c.

References xisspace.

Referenced by process_lru_command(), and process_slabs_automove_command().

◆ safe_strtol()

◆ safe_strtoll()

bool safe_strtoll ( const char *  str,
int64_t *  out 
)

Definition at line 104 of file util.c.

References xisspace.

Referenced by _mc_meta_load_cb(), slabs_init(), and test_safe_strtoll().

◆ safe_strtoul()

◆ safe_strtoull()

bool safe_strtoull ( const char *  str,
uint64_t *  out 
)

◆ safe_strtoull_hex()

bool safe_strtoull_hex ( const char *  str,
uint64_t *  out 
)

Definition at line 79 of file util.c.

References xisspace.

Referenced by _mc_meta_load_cb().

◆ uriencode()

bool uriencode ( const char *  src,
char *  dst,
const size_t  srclen,
const size_t  dstlen 
)

Definition at line 28 of file util.c.

References uriencode_map.

Referenced by _logger_parse_ee(), and crawler_metadump_eval().

◆ uriencode_init()

void uriencode_init ( void  )

Definition at line 14 of file util.c.

References uriencode_map, and uriencode_str.

Referenced by main().

◆ vperror()

void vperror ( const char *  fmt,
  ... 
)

Vararg variant of perror that makes for more useful error messages when reporting with parameters.

Parameters
fmta printf format

Definition at line 223 of file util.c.

Referenced by main(), remove_pidfile(), save_pid(), and test_vperror().

Variable Documentation

◆ uriencode_map

char* uriencode_map[256]
static

Definition at line 11 of file util.c.

Referenced by uriencode(), and uriencode_init().

◆ uriencode_str

char uriencode_str[768]
static

Definition at line 12 of file util.c.

Referenced by uriencode_init().