#define WATCHPOINT_STRING(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__,A);fflush(stdout);
#define WATCHPOINT_NUMBER(A) printf("\nWATCHPOINT %s:%d (%s) %zu\n", __FILE__, __LINE__,__func__,(size_t)(A));fflush(stdout);
#define WATCHPOINT_ERRNO(A) printf("\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));A= 0;fflush(stdout);
+#define WATCHPOINT_ASSERT(A) assert((A));
#else
+/*
+#define WATCHPOINT { 1; };
+#define WATCHPOINT_ERROR(A) { 1; };
+#define WATCHPOINT_STRING(A) { 1; };
+#define WATCHPOINT_NUMBER(A) { 1; };
+#define WATCHPOINT_ERRNO(A) { 1; };
+#define WATCHPOINT_ASSERT(A) { 1; };
+*/
#define WATCHPOINT
-#define WATCHPOINT_ERROR(A)
+#define WATCHPOINT_ERROR(A)
#define WATCHPOINT_STRING(A)
#define WATCHPOINT_NUMBER(A)
#define WATCHPOINT_ERRNO(A)
+#define WATCHPOINT_ASSERT(A)
#endif
}
}
- assert(temp_flag); /* Programming mistake if it gets this far */
+ WATCHPOINT_ASSERT(temp_flag); /* Programming mistake if it gets this far */
if (ptr->flags & temp_flag)
return 1;
else
if (ptr->hosts[server_key].fd == -1)
{
/* Old connection junk still is in the structure */
- assert(ptr->hosts[server_key].stack_responses == 0);
+ WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
if ((h= gethostbyname(ptr->hosts[server_key].hostname)) == NULL)
{
}
ptr->connected++;
}
- assert(ptr->hosts[server_key].stack_responses == 0);
+ WATCHPOINT_ASSERT(ptr->hosts[server_key].stack_responses == 0);
}
return MEMCACHED_SUCCESS;
goto error;
}
else if (*error == MEMCACHED_END)
- assert(0); /* If this happens we have somehow messed up the fetch */
+ {
+ WATCHPOINT_ASSERT(0); /* If this happens we have somehow messed up the fetch */
+ }
else if (*error == MEMCACHED_SUCCESS)
{
memcached_return rc;
else if (*error == MEMCACHED_END && *value_length == 0)
return NULL;
else if (*error == MEMCACHED_END)
- assert(0); /* If this happens we have somehow messed up the fetch */
+ {
+ WATCHPOINT_ASSERT(0); /* If this happens we have somehow messed up the fetch */
+ }
else if (*error != MEMCACHED_SUCCESS)
return NULL;
else
hash= internal_generate_hash(key, key_length);
if (ptr->flags & MEM_USE_KETAMA)
- assert(0);
+ {
+ WATCHPOINT_ASSERT(0);
+ return 0;
+ }
else
return hash % ptr->number_of_hosts;
}
sent_length= memcached_io_flush(ptr, server_key);
- assert(sent_length == MEMCACHED_MAX_BUFFER);
+ WATCHPOINT_ASSERT(sent_length == MEMCACHED_MAX_BUFFER);
ptr->write_buffer_offset= 0;
}
}
memcached_server_st *servers= NULL;
memcached_return rc;
- assert(server_strings);
+ WATCHPOINT_ASSERT(server_strings);
end_ptr= server_strings + strlen(server_strings);
buffer_ptr++;
total_length++;
- assert(total_length < buffer_length);
+ WATCHPOINT_ASSERT(total_length < buffer_length);
}
if (memcached_server_response_count(ptr, server_key))
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
unsigned int server_key;
- assert(value);
- assert(value_length);
+ WATCHPOINT_ASSERT(value);
+ WATCHPOINT_ASSERT(value_length);
- /* Leaving this assert in since only a library fubar could blow this */
+ /* Leaving this WATCHPOINT_ASSERT in since only a library fubar could blow this */
#ifdef NOT_DONE
if (!(ptr->flags & MEM_NO_BLOCK) && ptr->write_buffer_offset != 0)
- assert(0);
+ WATCHPOINT_ASSERT(0);
#endif
server_key= memcached_generate_hash(ptr, key, key_length);
return NULL;
}
- assert(string->string == string->end);
+ WATCHPOINT_ASSERT(string->string == string->end);
return string;
}
{
memcached_return rc;
- WATCHPOINT;
rc= memcached_string_check(string, length);
- WATCHPOINT;
if (rc != MEMCACHED_SUCCESS)
return rc;
- WATCHPOINT;
- assert(string->string);
- assert(string->end >= string->string && string->end <= string->string + string->current_size);
+ WATCHPOINT_ASSERT(string->string);
+ WATCHPOINT_ASSERT(string->end >= string->string && string->end <= string->string + string->current_size);
- WATCHPOINT;
memcpy(string->end, value, length);
- WATCHPOINT;
string->end+= length;
return MEMCACHED_SUCCESS;