From 37369b0d8181ef403e577a5ebe29ab8d5b749e60 Mon Sep 17 00:00:00 2001 From: Dustin Sallings Date: Tue, 24 Mar 2009 08:10:47 -0700 Subject: Make APPEND_STAT globally available. --- memcached.c | 10 ---------- memcached.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/memcached.c b/memcached.c index a3f46aa..5ced667 100644 --- a/memcached.c +++ b/memcached.c @@ -2334,14 +2334,6 @@ uint32_t append_ascii_stats(char *buf, const char *key, const uint16_t klen, return nbytes; } -/* Local macro existing specifically to process stats */ -#define APPEND_STAT(fmt, name, val) \ - vlen = sprintf(val_str, fmt, val); \ - size = add_stats(pos, name, strlen(name), val_str, vlen, c); \ - *buflen += size; \ - pos += size; \ - assert(*buflen < allocated); - static char *process_stat_settings(uint32_t (*add_stats)(char *buf, const char *k, const uint16_t kl, @@ -2387,8 +2379,6 @@ static char *process_stat_settings(uint32_t (*add_stats)(char *buf, return buf; } -#undef APPEND_STAT - static void process_stat(conn *c, token_t *tokens, const size_t ntokens) { char *command; char *subcommand; diff --git a/memcached.h b/memcached.h index 9298192..f4cbdd3 100644 --- a/memcached.h +++ b/memcached.h @@ -175,6 +175,17 @@ typedef struct _stritem { + (item)->nsuffix + (item)->nbytes \ + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0)) +/* Stat processing macros */ + +/* Append a simple stat with a stat name, value format and value */ +#define APPEND_STAT(fmt, name, val) \ + vlen = sprintf(val_str, fmt, val); \ + size = add_stats(pos, name, strlen(name), val_str, vlen, c); \ + *buflen += size; \ + pos += size; \ + assert(*buflen < allocated); + + /** * NOTE: If you modify this table you _MUST_ update the function state_text */ -- cgit v1.2.1