<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -21,4 +21,5 @@ missing
 stamp-h1
 tags
 cscope.out
+memcached_dtrace.h
 *~</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)
 
 AC_PROG_CC
+AC_PROG_CC_C99
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
 
@@ -216,6 +217,7 @@ if test &quot;x$ac_cv_search_pthread_create&quot; != &quot;xno&quot;; then
     ])
   ],[
     CFLAGS=&quot;-mt $CFLAGS&quot;
+    SUNSTUDIO=true
   ])
 else
   AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
@@ -225,5 +227,17 @@ AC_CHECK_FUNCS(mlockall)
 AC_CHECK_FUNCS(getpagesizes)
 AC_CHECK_FUNCS(memcntl)
 
+dnl Let the compiler be a bit more picky. Please note that you cannot
+dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
+dnl the test program will generate a compilation warning and hence fail
+dnl to detect the function ;-)
+if test &quot;$GCC&quot; = &quot;yes&quot;
+then
+  CFLAGS=&quot;$CFLAGS -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls&quot;
+elif test &quot;$SUNSTUDIO&quot; = &quot;true&quot;
+then
+  CFLAGS=&quot;$CFLAGS -errfmt=error -errwarn -errshort=tags&quot;
+fi
+
 AC_CONFIG_FILES(Makefile doc/Makefile)
 AC_OUTPUT</diff>
      <filename>configure.ac</filename>
    </modified>
    <modified>
      <diff>@@ -38,6 +38,8 @@
 #include &lt;stdlib.h&gt;
 #include &lt;unistd.h&gt;
 
+#include &quot;memcached.h&quot;
+
 int daemon(int nochdir, int noclose)
 {
     int fd;</diff>
      <filename>daemon.c</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@
 /* Forward Declarations */
 static void item_link_q(item *it);
 static void item_unlink_q(item *it);
-static uint64_t get_cas_id();
+static uint64_t get_cas_id(void);
 
 /*
  * We only reposition items in the LRU queue if they haven't been repositioned
@@ -49,7 +49,7 @@ void item_init(void) {
 }
 
 /* Get the next CAS id for a new item. */
-uint64_t get_cas_id() {
+uint64_t get_cas_id(void) {
     static uint64_t cas_id = 0;
     return ++cas_id;
 }</diff>
      <filename>items.c</filename>
    </modified>
    <modified>
      <diff>@@ -53,10 +53,6 @@ std *
 #endif
 #endif
 
-#ifndef HAVE_DAEMON
-extern int daemon(int nochdir, int noclose);
-#endif
-
 /*
  * forward declarations
  */
@@ -759,7 +755,7 @@ static int build_udp_headers(conn *c) {
 
     hdr = c-&gt;hdrbuf;
     for (i = 0; i &lt; c-&gt;msgused; i++) {
-        c-&gt;msglist[i].msg_iov[0].iov_base = hdr;
+        c-&gt;msglist[i].msg_iov[0].iov_base = (void*)hdr;
         c-&gt;msglist[i].msg_iov[0].iov_len = UDP_HEADER_SIZE;
         *hdr++ = c-&gt;request_id / 256;
         *hdr++ = c-&gt;request_id % 256;
@@ -769,7 +765,7 @@ static int build_udp_headers(conn *c) {
         *hdr++ = c-&gt;msgused % 256;
         *hdr++ = 0;
         *hdr++ = 0;
-        assert((void *) hdr == (void *)c-&gt;msglist[i].msg_iov[0].iov_base + UDP_HEADER_SIZE);
+        assert((void *) hdr == (caddr_t)c-&gt;msglist[i].msg_iov[0].iov_base + UDP_HEADER_SIZE);
     }
 
     return 0;
@@ -1045,7 +1041,6 @@ static void complete_incr_bin(conn *c) {
     if (it &amp;&amp; (c-&gt;binary_header.request.cas == 0 || c-&gt;binary_header.request.cas == it-&gt;cas_id)) {
         /* Weird magic in add_delta forces me to pad here */
         char tmpbuf[INCR_MAX_STORAGE_LEN];
-        uint64_t l = 0;
         add_delta(c, it, c-&gt;cmd == PROTOCOL_BINARY_CMD_INCREMENT,
                   req-&gt;message.body.delta, tmpbuf);
         rsp-&gt;message.body.value = swap64(strtoull(tmpbuf, NULL, 10));
@@ -1155,7 +1150,6 @@ static void process_bin_get(conn *c) {
     item *it;
 
     protocol_binary_response_get* rsp = (protocol_binary_response_get*)c-&gt;wbuf;
-    protocol_binary_request_get* req = binary_get_request(c);
     char* key = binary_get_key(c);
     size_t nkey = c-&gt;binary_header.request.keylen;
 
@@ -1349,7 +1343,6 @@ static void bin_read_key(conn *c, enum bin_substates next_substate, int extra) {
 }
 
 static void dispatch_bin_command(conn *c) {
-    time_t exptime = 0;
     int protocol_error = 0;
 
     int extlen = c-&gt;binary_header.request.extlen;
@@ -1535,7 +1528,6 @@ static void process_bin_append_prepend(conn *c) {
     int nkey;
     int vlen;
     item *it;
-    protocol_binary_request_append* req = binary_get_request(c);
 
     assert(c != NULL);
 
@@ -1607,14 +1599,12 @@ static void process_bin_flush(conn *c) {
 static void process_bin_delete(conn *c) {
     item *it;
 
-    protocol_binary_response_delete* rsp = (protocol_binary_response_delete*)c-&gt;wbuf;
     protocol_binary_request_delete* req = binary_get_request(c);
 
     char* key = binary_get_key(c);
     size_t nkey = c-&gt;binary_header.request.keylen;
 
     assert(c != NULL);
-    assert(c-&gt;wsize &gt;= sizeof(*rsp));
 
     if (settings.verbose) {
         fprintf(stderr, &quot;Deleting %s\n&quot;, key);
@@ -1936,7 +1926,7 @@ static char *server_stats(bool binprot, int *buflen) {
 #endif /* !WIN32 */
 
     STATS_LOCK();
-    pos += sprintf(pos, &quot;STAT pid %u\r\n&quot;, pid);
+    pos += sprintf(pos, &quot;STAT pid %lu\r\n&quot;, (long)pid);
     pos += sprintf(pos, &quot;STAT uptime %u\r\n&quot;, now);
     pos += sprintf(pos, &quot;STAT time %ld\r\n&quot;, now + stats.started);
     pos += sprintf(pos, &quot;STAT version &quot; VERSION &quot;\r\n&quot;);
@@ -2024,7 +2014,6 @@ uint32_t append_ascii_stats(char *buf, const char *key, const uint16_t klen,
 }
 
 static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
-    rel_time_t now = current_time;
     char *command;
     char *subcommand;
 
@@ -2357,9 +2346,9 @@ static void process_update_command(conn *c, token_t *tokens, const size_t ntoken
     size_t nkey;
     int flags;
     time_t exptime;
-    int vlen, old_vlen;
+    int vlen;
     uint64_t req_cas_id=0;
-    item *it, *old_it;
+    item *it;
 
     assert(c != NULL);
 
@@ -2986,7 +2975,7 @@ static int transmit(conn *c) {
             /* Might have written just part of the last iovec entry;
                adjust it so the next write will do the rest. */
             if (res &gt; 0) {
-                m-&gt;msg_iov-&gt;iov_base += res;
+                m-&gt;msg_iov-&gt;iov_base = (caddr_t)m-&gt;msg_iov-&gt;iov_base + res;
                 m-&gt;msg_iov-&gt;iov_len -= res;
             }
             return TRANSMIT_INCOMPLETE;
@@ -3273,6 +3262,10 @@ static void drive_machine(conn *c) {
                 conn_close(c);
             stop = true;
             break;
+
+        case conn_max_state:
+            assert(false);
+            break;
         }
     }
 
@@ -3738,7 +3731,7 @@ static void sig_handler(const int sig) {
  * On systems that supports multiple page sizes we may reduce the
  * number of TLB-misses by using the biggest available page size
  */
-int enable_large_pages(void) {
+static int enable_large_pages(void) {
     int ret = -1;
     size_t sizes[32];
     int avail = getpagesizes(sizes, 32);
@@ -3787,11 +3780,9 @@ int main (int argc, char **argv) {
     struct rlimit rlim;
     /* listening sockets */
     static int *l_socket = NULL;
-    static int *bl_socket = NULL;
 
     /* udp socket */
     static int *u_socket = NULL;
-    static int u_socket_count = 0;
 
     /* handle SIGINT */
     signal(SIGINT, sig_handler);</diff>
      <filename>memcached.c</filename>
    </modified>
    <modified>
      <diff>@@ -272,15 +272,22 @@ extern volatile rel_time_t current_time;
  * Functions
  */
 
-conn *do_conn_from_freelist();
+conn *do_conn_from_freelist(void);
 bool do_conn_add_to_freelist(conn *c);
-char *do_suffix_from_freelist();
+char *do_suffix_from_freelist(void);
 bool do_suffix_add_to_freelist(char *s);
 char *do_add_delta(conn *c, item *item, const bool incr, const int64_t delta,
                    char *buf);
 int do_store_item(item *item, int comm, conn* c);
 conn *conn_new(const int sfd, const enum conn_states init_state, const int event_flags, const int read_buffer_size, enum protocol prot, struct event_base *base);
+uint32_t append_bin_stats(char *buf, const char *key, const uint16_t klen,
+                          const char *val, const uint32_t vlen);
+uint32_t append_ascii_stats(char *buf, const char *key, const uint16_t klen,
+                            const char *val, const uint32_t vlen);
 
+#ifndef HAVE_DAEMON
+extern int daemon(int nochdir, int noclose);
+#endif
 
 #include &quot;stats.h&quot;
 #include &quot;slabs.h&quot;</diff>
      <filename>memcached.h</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,7 @@ extern &quot;C&quot;
    */
   typedef enum {
     PROTOCOL_BINARY_REQ = 0x80,
-    PROTOCOL_BINARY_RES = 0x81,
+    PROTOCOL_BINARY_RES = 0x81
   } protocol_binary_magic;
 
   /**
@@ -69,7 +69,7 @@ extern &quot;C&quot;
     PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04,
     PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05,
     PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
-    PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82,
+    PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82
   } protocol_binary_response_status;
 
   /**
@@ -93,7 +93,7 @@ extern &quot;C&quot;
     PROTOCOL_BINARY_CMD_GETKQ = 0x0d,
     PROTOCOL_BINARY_CMD_APPEND = 0x0e,
     PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
-    PROTOCOL_BINARY_CMD_STAT    = 0x10,
+    PROTOCOL_BINARY_CMD_STAT = 0x10
   } protocol_binary_command;
 
   /**
@@ -101,7 +101,7 @@ extern &quot;C&quot;
    * See section 3.4 Data Types
    */
   typedef enum {
-    PROTOCOL_BINARY_RAW_BYTES = 0x00,
+    PROTOCOL_BINARY_RAW_BYTES = 0x00
   } protocol_binary_datatypes;
 
   /**</diff>
      <filename>protocol_binary.h</filename>
    </modified>
    <modified>
      <diff>@@ -265,7 +265,7 @@ void *do_slabs_alloc(const size_t size, unsigned int id) {
         assert(p-&gt;end_page_ptr != NULL);
         ret = p-&gt;end_page_ptr;
         if (--p-&gt;end_page_free != 0) {
-            p-&gt;end_page_ptr += p-&gt;size;
+            p-&gt;end_page_ptr = ((caddr_t)p-&gt;end_page_ptr) + p-&gt;size;
         } else {
             p-&gt;end_page_ptr = 0;
         }
@@ -333,7 +333,7 @@ char *get_stats(const bool bin_prot, const char *stat_type,
         pos = buf;
 
         /* prepare general statistics for the engine */
-        sprintf(val, &quot;%llu&quot;, stats.curr_bytes);
+        sprintf(val, &quot;%llu&quot;, (unsigned long long)stats.curr_bytes);
         size = add_stats(pos, &quot;bytes&quot;, strlen(&quot;bytes&quot;), val, strlen(val));
         *buflen += size;
         pos += size;
@@ -350,7 +350,7 @@ char *get_stats(const bool bin_prot, const char *stat_type,
         *buflen += size;
         pos += size;
 
-        sprintf(val, &quot;%llu&quot;, stats.evictions);
+        sprintf(val, &quot;%llu&quot;, (unsigned long long)stats.evictions);
         size = add_stats(pos, &quot;evictions&quot;, strlen(&quot;evictions&quot;), val,
                          strlen(val));
         *buflen += size;
@@ -389,61 +389,61 @@ char *get_stats(const bool bin_prot, const char *stat_type,
         char val[128];
         uint32_t nbytes = 0;
 
-        sprintf(val, &quot;%d&quot;, info.arena);
+        sprintf(val, &quot;%ld&quot;, info.arena);
         nbytes = add_stats(pos, &quot;arena_size&quot;, strlen(&quot;arena_size&quot;), val,
                            strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.ordblks);
+        sprintf(val, &quot;%ld&quot;, info.ordblks);
         nbytes = add_stats(pos, &quot;free_chunks&quot;, strlen(&quot;free_chunks&quot;), val,
                            strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.smblks);
+        sprintf(val, &quot;%ld&quot;, info.smblks);
         nbytes = add_stats(pos, &quot;fastbin_blocks&quot;, strlen(&quot;fastbin_blocks&quot;),
                            val, strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.hblks);
+        sprintf(val, &quot;%ld&quot;, info.hblks);
         nbytes = add_stats(pos, &quot;mmapped_regions&quot;, strlen(&quot;mmapped_regions&quot;),
                            val, strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.hblkhd);
+        sprintf(val, &quot;%ld&quot;, info.hblkhd);
         nbytes = add_stats(pos, &quot;mmapped_space&quot;, strlen(&quot;mmapped_space&quot;),
                            val, strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.usmblks);
+        sprintf(val, &quot;%ld&quot;, info.usmblks);
         nbytes = add_stats(pos, &quot;max_total_alloc&quot;, strlen(&quot;max_total_alloc&quot;),
                            val, strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.fsmblks);
+        sprintf(val, &quot;%ld&quot;, info.fsmblks);
         nbytes = add_stats(pos, &quot;fastbin_space&quot;, strlen(&quot;fastbin_space&quot;),
                            val, strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.uordblks);
+        sprintf(val, &quot;%ld&quot;, info.uordblks);
         nbytes = add_stats(pos, &quot;total_alloc&quot;, strlen(&quot;total_alloc&quot;), val,
                            strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.fordblks);
+        sprintf(val, &quot;%ld&quot;, info.fordblks);
         nbytes = add_stats(pos, &quot;total_free&quot;, strlen(&quot;total_free&quot;), val,
                             strlen(val));
         linelen += nbytes;
         pos += nbytes;
 
-        sprintf(val, &quot;%d&quot;, info.keepcost);
+        sprintf(val, &quot;%ld&quot;, info.keepcost);
         nbytes = add_stats(pos, &quot;releasable_space&quot;,
                            strlen(&quot;releasable_space&quot;), val, strlen(val));
         linelen += nbytes;
@@ -546,7 +546,7 @@ char *do_slabs_stats(int *buflen, uint32_t (*add_stats)(char *buf,
     bufcurr += nbytes;
 
     sprintf(key, &quot;total_malloced&quot;);
-    sprintf(val, &quot;%llu&quot;, (uint64_t)mem_malloced);
+    sprintf(val, &quot;%llu&quot;, (unsigned long long)mem_malloced);
     nbytes = add_stats(bufcurr, key, strlen(key), val, strlen(val));
     linelen += nbytes;
     bufcurr += nbytes;
@@ -647,7 +647,7 @@ static void *memory_allocate(size_t size) {
             size += CHUNK_ALIGN_BYTES - (size % CHUNK_ALIGN_BYTES);
         }
 
-        mem_current += size;
+        mem_current = ((char*)mem_current) + size;
         if (size &lt; mem_avail) {
             mem_avail -= size;
         } else {</diff>
      <filename>slabs.c</filename>
    </modified>
    <modified>
      <diff>@@ -155,7 +155,7 @@ static void cq_push(CQ *cq, CQ_ITEM *item) {
 /*
  * Returns a fresh connection queue item.
  */
-static CQ_ITEM *cqi_new() {
+static CQ_ITEM *cqi_new(void) {
     CQ_ITEM *item = NULL;
     pthread_mutex_lock(&amp;cqi_freelist_lock);
     if (cqi_freelist) {
@@ -321,7 +321,8 @@ static void *worker_libevent(void *arg) {
     pthread_cond_signal(&amp;init_cond);
     pthread_mutex_unlock(&amp;init_lock);
 
-    return (void*) event_base_loop(me-&gt;base, 0);
+    event_base_loop(me-&gt;base, 0);
+    return NULL;
 }
 
 </diff>
      <filename>thread.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0ed1d435af24de719d0e0ee28b4ff2c1e24725fd</id>
    </parent>
  </parents>
  <author>
    <name>Trond Norbye</name>
    <email>tn202803@khepri38.(none)</email>
  </author>
  <url>http://github.com/tmaesaka/memcached/commit/a9fab8e0c981f29ee1f43bbe486660b441544ec9</url>
  <id>a9fab8e0c981f29ee1f43bbe486660b441544ec9</id>
  <committed-date>2008-10-06T03:52:41-07:00</committed-date>
  <authored-date>2008-10-06T03:52:41-07:00</authored-date>
  <message>Removed compiler warnings and increased warning level</message>
  <tree>61bc216982f09e9768f80e0e71485307e34057e1</tree>
  <committer>
    <name>Trond Norbye</name>
    <email>tn202803@khepri38.(none)</email>
  </committer>
</commit>
