Merge lp:~trond-norbye/libmemcached/deprecated into lp:~tangent-org/libmemcached/trunk

Proposed by Trond Norbye
Status: Merged
Merged at revision: not available
Proposed branch: lp:~trond-norbye/libmemcached/deprecated
Merge into: lp:~tangent-org/libmemcached/trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~trond-norbye/libmemcached/deprecated
Reviewer Review Type Date Requested Status
Brian Aker Approve
Review via email: mp+7731@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

Deprecate the use of the callback functions to set the memory allocators (to force the user to start using the new ones). They are available if you pass --enable-deprecated to configure.

Revision history for this message
Brian Aker (brianaker) wrote :

Looks good!

BTW I an Monty were discussing the issue of maybe deprecating the callback() setters and making separate callers for each of them.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libmemcached/memcached_callback.c'
2--- libmemcached/memcached_callback.c 2009-05-13 07:43:30 +0000
3+++ libmemcached/memcached_callback.c 2009-06-21 10:59:22 +0000
4@@ -62,6 +62,7 @@
5 ptr->on_clone= func;
6 break;
7 }
8+#ifdef MEMCACHED_ENABLE_DEPRECATED
9 case MEMCACHED_CALLBACK_MALLOC_FUNCTION:
10 {
11 memcached_malloc_function func= *(memcached_malloc_function *)&data;
12@@ -80,6 +81,7 @@
13 ptr->call_free= func;
14 break;
15 }
16+#endif
17 case MEMCACHED_CALLBACK_GET_FAILURE:
18 {
19 memcached_trigger_key func= *(memcached_trigger_key *)&data;
20@@ -138,6 +140,7 @@
21 *error= ptr->on_clone ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
22 return *(void **)&ptr->on_clone;
23 }
24+#ifdef MEMCACHED_ENABLE_DEPRECATED
25 case MEMCACHED_CALLBACK_MALLOC_FUNCTION:
26 {
27 *error= ptr->call_malloc ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
28@@ -153,6 +156,7 @@
29 *error= ptr->call_free ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
30 return *(void **)&ptr->call_free;
31 }
32+#endif
33 case MEMCACHED_CALLBACK_GET_FAILURE:
34 {
35 *error= ptr->get_key_failure ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
36
37=== modified file 'libmemcached/memcached_constants.h'
38--- libmemcached/memcached_constants.h 2009-06-09 19:36:39 +0000
39+++ libmemcached/memcached_constants.h 2009-06-21 10:59:22 +0000
40@@ -110,15 +110,17 @@
41 } memcached_behavior;
42
43 typedef enum {
44- MEMCACHED_CALLBACK_PREFIX_KEY,
45- MEMCACHED_CALLBACK_USER_DATA,
46- MEMCACHED_CALLBACK_CLEANUP_FUNCTION,
47- MEMCACHED_CALLBACK_CLONE_FUNCTION,
48- MEMCACHED_CALLBACK_MALLOC_FUNCTION,
49- MEMCACHED_CALLBACK_REALLOC_FUNCTION,
50- MEMCACHED_CALLBACK_FREE_FUNCTION,
51- MEMCACHED_CALLBACK_GET_FAILURE,
52- MEMCACHED_CALLBACK_DELETE_TRIGGER
53+ MEMCACHED_CALLBACK_PREFIX_KEY = 0,
54+ MEMCACHED_CALLBACK_USER_DATA = 1,
55+ MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2,
56+ MEMCACHED_CALLBACK_CLONE_FUNCTION = 3,
57+#ifdef MEMCACHED_ENABLE_DEPRECATED
58+ MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4,
59+ MEMCACHED_CALLBACK_REALLOC_FUNCTION = 5,
60+ MEMCACHED_CALLBACK_FREE_FUNCTION = 6,
61+#endif
62+ MEMCACHED_CALLBACK_GET_FAILURE = 7,
63+ MEMCACHED_CALLBACK_DELETE_TRIGGER = 8
64 } memcached_callback;
65
66 typedef enum {
67
68=== modified file 'tests/function.c'
69--- tests/function.c 2009-06-20 19:18:01 +0000
70+++ tests/function.c 2009-06-21 10:59:22 +0000
71@@ -3160,6 +3160,7 @@
72 return MEMCACHED_SUCCESS;
73 }
74
75+#ifdef MEMCACHED_ENABLE_DEPRECATED
76 static memcached_return deprecated_set_memory_alloc(memcached_st *memc)
77 {
78 void *test_ptr= NULL;
79@@ -3204,6 +3205,7 @@
80 }
81 return MEMCACHED_SUCCESS;
82 }
83+#endif
84
85 static memcached_return set_memory_alloc(memcached_st *memc)
86 {
87@@ -4536,7 +4538,9 @@
88 {"poll_timeout", poll_timeout, 0, tests},
89 {"gets", enable_cas, 0, tests},
90 {"consistent", enable_consistent, 0, tests},
91+#ifdef MEMCACHED_ENABLE_DEPRECATED
92 {"deprecated_memory_allocators", deprecated_set_memory_alloc, 0, tests},
93+#endif
94 {"memory_allocators", set_memory_alloc, 0, tests},
95 {"prefix", set_prefix, 0, tests},
96 {"version_1_2_3", check_for_1_2_3, 0, version_1_2_3},

Subscribers

People subscribed via source and target branches

to all changes: