-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
45 lines (43 loc) · 1.01 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef __UTIL_H
#define __UTIL_H
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include "server.h"
struct sdshdr {
unsigned int len;
unsigned int free;
char buf[];
};
// LOG_DEBUG 0
// LOG_NOTICE 1
// LOG_ERROR 2
#ifdef __cplusplus
extern "C" {
#endif
void chLog(int level, const char *fmt, ...);
#ifdef __cplusplus
}
#endif
char *sdsnewlen(const void *init, size_t initlen);
char *sdsnew(const char *init);
int msgcmp(const struct msg *s, const char *dest);
char *msgdup(const struct msg *s);
void sdsfree(char *s);
int string2ll(const char *s, size_t slen, long long *value);
char *getAbsolutePath(char *filename);
void loadServerConfig(char *filename);
void parsingMessage(struct kvClient *c);
struct kvObject *createObject(void *ptr, size_t len);
void *chmalloc(size_t size);
void *chcalloc(size_t size);
void chfree(void *ptr);
size_t get_used_memory(void);
#endif