Merge lp:~yeban/libmemcached/todo-hosts.c-2 into lp:~tangent-org/libmemcached/trunk

Proposed by Anuarg Priyam
Status: Merged
Approved by: Brian Aker
Approved revision: 934
Merged at revision: 947
Proposed branch: lp:~yeban/libmemcached/todo-hosts.c-2
Merge into: lp:~tangent-org/libmemcached/trunk
Diff against target: 28 lines (+7/-3)
1 file modified
libmemcached/hosts.c (+7/-3)
To merge this branch: bzr merge lp:~yeban/libmemcached/todo-hosts.c-2
Reviewer Review Type Date Requested Status
Libmemcached-developers Pending
Review via email: mp+57121@code.launchpad.net

Description of the change

Second attempt at addressing a marked TODO in hosts.c - check return type of memcached_server_create_with in server_add, and remove a bogus TODO marker.

To post a comment you must log in.
Revision history for this message
Anuarg Priyam (yeban) wrote :

Maybe memcached_set_error is not needed, as server_add is mostly an intermediate call.

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

Merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libmemcached/hosts.c'
2--- libmemcached/hosts.c 2011-04-07 23:12:37 +0000
3+++ libmemcached/hosts.c 2011-04-11 08:47:37 +0000
4@@ -341,7 +341,6 @@
5 instance= memcached_server_instance_fetch(ptr, memcached_server_count(ptr));
6 WATCHPOINT_ASSERT(instance);
7
8- /* TODO check return type */
9 instance= memcached_server_create_with(ptr, instance, list[x].hostname,
10 list[x].port, list[x].weight, list[x].type);
11 if (! instance)
12@@ -439,9 +438,14 @@
13
14 memcached_server_list_set(ptr, new_host_list);
15
16- /* TODO: Check return type */
17 instance= memcached_server_instance_fetch(ptr, memcached_server_count(ptr));
18- (void)memcached_server_create_with(ptr, instance, hostname, port, weight, type);
19+ WATCHPOINT_ASSERT(instance);
20+
21+ instance= memcached_server_create_with(ptr, instance, hostname, port, weight, type);
22+ if (! instance)
23+ {
24+ return memcached_set_error(ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, NULL);
25+ }
26 ptr->number_of_hosts++;
27
28 instance= memcached_server_instance_fetch(ptr, 0);

Subscribers

People subscribed via source and target branches

to all changes: