- {
- char *rel_ptr;
- char *startptr= buffer + 13, *endptr= startptr;
-
- while (*endptr != '\r' && *endptr != '\n') endptr++;
-
- /*
- Yes, we could make this "efficent" but to do that we would need
- to maintain more state for the size of the buffer. Why waste
- memory in the struct, which is important, for something that
- rarely should happen?
- */
- rel_ptr= (char *)ptr->root->call_realloc(ptr->root,
- ptr->cached_server_error,
- (size_t) (endptr - startptr + 1));
-
- if (rel_ptr == NULL)
- {
- /* If we happened to have some memory, we just null it since we don't know the size */
- if (ptr->cached_server_error)
- ptr->cached_server_error[0]= 0;
- return MEMCACHED_SERVER_ERROR;
- }
- ptr->cached_server_error= rel_ptr;
-
- memcpy(ptr->cached_server_error, startptr, (size_t) (endptr - startptr));
- ptr->cached_server_error[endptr - startptr]= 0;
- return MEMCACHED_SERVER_ERROR;
- }
+ {
+ char *rel_ptr;
+ char *startptr= buffer + 13, *endptr= startptr;
+
+ while (*endptr != '\r' && *endptr != '\n') endptr++;
+
+ /*
+ Yes, we could make this "efficent" but to do that we would need
+ to maintain more state for the size of the buffer. Why waste
+ memory in the struct, which is important, for something that
+ rarely should happen?
+ */
+ rel_ptr= (char *)libmemcached_realloc(ptr->root,
+ ptr->cached_server_error,
+ (size_t) (endptr - startptr + 1));
+
+ if (rel_ptr == NULL)
+ {
+ /* If we happened to have some memory, we just null it since we don't know the size */
+ if (ptr->cached_server_error)
+ ptr->cached_server_error[0]= 0;
+ return MEMCACHED_SERVER_ERROR;
+ }
+ ptr->cached_server_error= rel_ptr;
+
+ memcpy(ptr->cached_server_error, startptr, (size_t) (endptr - startptr));
+ ptr->cached_server_error[endptr - startptr]= 0;
+ return MEMCACHED_SERVER_ERROR;
+ }