Permalink
Browse files

Don't use static inline in header

Some compilers may emit warnings if the function isn't called
(causing a buildbreak with warnings == error). It's a premature
optimization anyway

Change-Id: I54b57eb473b4d6b03923d11b23786333f20e1b1b
Reviewed-on: http://review.couchbase.org/20337
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
  • Loading branch information...
1 parent 19a3e34 commit f6c89591341bb39bbc57520036f0452a8a229ce1 @trondn trondn committed with avsej Aug 30, 2012
Showing with 132 additions and 97 deletions.
  1. +97 −0 src/handler.c
  2. +35 −97 src/handler.h
View
@@ -25,6 +25,103 @@
#include "internal.h"
+void setup_lcb_get_resp_t(lcb_get_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ const void *bytes,
+ lcb_size_t nbytes,
+ lcb_uint32_t flags,
+ lcb_cas_t cas,
+ lcb_datatype_t datatype)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+ resp->v.v0.bytes = bytes;
+ resp->v.v0.nbytes = nbytes;
+ resp->v.v0.flags = flags;
+ resp->v.v0.cas = cas;
+ resp->v.v0.datatype = datatype;
+}
+
+void setup_lcb_remove_resp_t(lcb_remove_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey)
+{
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+}
+
+void setup_lcb_store_resp_t(lcb_store_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+ resp->v.v0.cas = cas;
+}
+
+void setup_lcb_touch_resp_t(lcb_touch_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+ resp->v.v0.cas = cas;
+}
+
+void setup_lcb_unlock_resp_t(lcb_unlock_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+}
+
+void setup_lcb_arithmetic_resp_t(lcb_arithmetic_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_uint64_t value,
+ lcb_cas_t cas)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+ resp->v.v0.value = value;
+ resp->v.v0.cas = cas;
+}
+
+void setup_lcb_observe_resp_t(lcb_observe_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas,
+ lcb_observe_t status,
+ int from_master,
+ lcb_time_t ttp,
+ lcb_time_t ttr)
+{
+ memset(resp, 0, sizeof(*resp));
+ resp->version = 0;
+ resp->v.v0.key = key;
+ resp->v.v0.nkey = nkey;
+ resp->v.v0.cas = cas;
+ resp->v.v0.status = status;
+ resp->v.v0.from_master = from_master;
+ resp->v.v0.ttp = ttp;
+ resp->v.v0.ttr = ttr;
+}
+
static lcb_error_t map_error(protocol_binary_response_status in)
{
switch (in) {
View
@@ -1,101 +1,39 @@
#ifndef HANDLER_H
#define HANDLER_H 1
-static inline void setup_lcb_get_resp_t(lcb_get_resp_t *resp,
- const void *key,
- lcb_size_t nkey,
- const void *bytes,
- lcb_size_t nbytes,
- lcb_uint32_t flags,
- lcb_cas_t cas,
- lcb_datatype_t datatype)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
- resp->v.v0.bytes = bytes;
- resp->v.v0.nbytes = nbytes;
- resp->v.v0.flags = flags;
- resp->v.v0.cas = cas;
- resp->v.v0.datatype = datatype;
-}
-
-static inline void setup_lcb_remove_resp_t(lcb_remove_resp_t *resp,
- const void *key,
- lcb_size_t nkey)
-{
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
-}
-
-static inline void setup_lcb_store_resp_t(lcb_store_resp_t *resp,
- const void *key,
- lcb_size_t nkey,
- lcb_cas_t cas)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
- resp->v.v0.cas = cas;
-}
-
-static inline void setup_lcb_touch_resp_t(lcb_touch_resp_t *resp,
- const void *key,
- lcb_size_t nkey,
- lcb_cas_t cas)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
- resp->v.v0.cas = cas;
-}
-
-static inline void setup_lcb_unlock_resp_t(lcb_unlock_resp_t *resp,
- const void *key,
- lcb_size_t nkey)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
-}
-
-static inline void setup_lcb_arithmetic_resp_t(lcb_arithmetic_resp_t *resp,
- const void *key,
- lcb_size_t nkey,
- lcb_uint64_t value,
- lcb_cas_t cas)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
- resp->v.v0.value = value;
- resp->v.v0.cas = cas;
-}
-
-static inline void setup_lcb_observe_resp_t(lcb_observe_resp_t *resp,
- const void *key,
- lcb_size_t nkey,
- lcb_cas_t cas,
- lcb_observe_t status,
- int from_master,
- lcb_time_t ttp,
- lcb_time_t ttr)
-{
- memset(resp, 0, sizeof(*resp));
- resp->version = 0;
- resp->v.v0.key = key;
- resp->v.v0.nkey = nkey;
- resp->v.v0.cas = cas;
- resp->v.v0.status = status;
- resp->v.v0.from_master = from_master;
- resp->v.v0.ttp = ttp;
- resp->v.v0.ttr = ttr;
-}
-
+void setup_lcb_get_resp_t(lcb_get_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ const void *bytes,
+ lcb_size_t nbytes,
+ lcb_uint32_t flags,
+ lcb_cas_t cas,
+ lcb_datatype_t datatype);
+void setup_lcb_remove_resp_t(lcb_remove_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey);
+void setup_lcb_store_resp_t(lcb_store_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas);
+void setup_lcb_touch_resp_t(lcb_touch_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas);
+void setup_lcb_unlock_resp_t(lcb_unlock_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey);
+void setup_lcb_arithmetic_resp_t(lcb_arithmetic_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_uint64_t value,
+ lcb_cas_t cas);
+void setup_lcb_observe_resp_t(lcb_observe_resp_t *resp,
+ const void *key,
+ lcb_size_t nkey,
+ lcb_cas_t cas,
+ lcb_observe_t status,
+ int from_master,
+ lcb_time_t ttp,
+ lcb_time_t ttr);
#endif

0 comments on commit f6c8959

Please sign in to comment.