Use calloc to allocate the result structure to initialize the object data
[m6w6/libmemcached] / libmemcached / strerror.c
1 #include "common.h"
2
3 const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return_t rc)
4 {
5 switch (rc)
6 {
7 case MEMCACHED_SUCCESS:
8 return "SUCCESS";
9 case MEMCACHED_FAILURE:
10 return "FAILURE";
11 case MEMCACHED_HOST_LOOKUP_FAILURE:
12 return "HOSTNAME LOOKUP FAILURE";
13 case MEMCACHED_CONNECTION_FAILURE:
14 return "CONNECTION FAILURE";
15 case MEMCACHED_CONNECTION_BIND_FAILURE:
16 return "CONNECTION BIND FAILURE";
17 case MEMCACHED_READ_FAILURE:
18 return "READ FAILURE";
19 case MEMCACHED_UNKNOWN_READ_FAILURE:
20 return "UNKNOWN READ FAILURE";
21 case MEMCACHED_PROTOCOL_ERROR:
22 return "PROTOCOL ERROR";
23 case MEMCACHED_CLIENT_ERROR:
24 return "CLIENT ERROR";
25 case MEMCACHED_SERVER_ERROR:
26 return "SERVER ERROR";
27 case MEMCACHED_WRITE_FAILURE:
28 return "WRITE FAILURE";
29 case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE:
30 return "CONNECTION SOCKET CREATE FAILURE";
31 case MEMCACHED_DATA_EXISTS:
32 return "CONNECTION DATA EXISTS";
33 case MEMCACHED_DATA_DOES_NOT_EXIST:
34 return "CONNECTION DATA DOES NOT EXIST";
35 case MEMCACHED_NOTSTORED:
36 return "NOT STORED";
37 case MEMCACHED_STORED:
38 return "STORED";
39 case MEMCACHED_NOTFOUND:
40 return "NOT FOUND";
41 case MEMCACHED_MEMORY_ALLOCATION_FAILURE:
42 return "MEMORY ALLOCATION FAILURE";
43 case MEMCACHED_PARTIAL_READ:
44 return "PARTIAL READ";
45 case MEMCACHED_SOME_ERRORS:
46 return "SOME ERRORS WERE REPORTED";
47 case MEMCACHED_NO_SERVERS:
48 return "NO SERVERS DEFINED";
49 case MEMCACHED_END:
50 return "SERVER END";
51 case MEMCACHED_DELETED:
52 return "SERVER DELETE";
53 case MEMCACHED_VALUE:
54 return "SERVER VALUE";
55 case MEMCACHED_STAT:
56 return "STAT VALUE";
57 case MEMCACHED_ITEM:
58 return "ITEM VALUE";
59 case MEMCACHED_ERRNO:
60 return "SYSTEM ERROR";
61 case MEMCACHED_FAIL_UNIX_SOCKET:
62 return "COULD NOT OPEN UNIX SOCKET";
63 case MEMCACHED_NOT_SUPPORTED:
64 return "ACTION NOT SUPPORTED";
65 case MEMCACHED_FETCH_NOTFINISHED:
66 return "FETCH WAS NOT COMPLETED";
67 case MEMCACHED_NO_KEY_PROVIDED:
68 return "A KEY LENGTH OF ZERO WAS PROVIDED";
69 case MEMCACHED_BUFFERED:
70 return "ACTION QUEUED";
71 case MEMCACHED_TIMEOUT:
72 return "A TIMEOUT OCCURRED";
73 case MEMCACHED_BAD_KEY_PROVIDED:
74 return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
75 case MEMCACHED_INVALID_HOST_PROTOCOL:
76 return "THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT";
77 case MEMCACHED_SERVER_MARKED_DEAD:
78 return "SERVER IS MARKED DEAD";
79 case MEMCACHED_UNKNOWN_STAT_KEY:
80 return "ENCOUNTERED AN UNKNOWN STAT KEY";
81 case MEMCACHED_E2BIG:
82 return "ITEM TOO BIG";
83 case MEMCACHED_INVALID_ARGUMENTS:
84 return "INVALID ARGUMENTS";
85 case MEMCACHED_MAXIMUM_RETURN:
86 return "Gibberish returned!";
87 default:
88 return "Gibberish returned!";
89 }
90 }