[sr-dev] git:master:040fea8c: jsonrpcs: reordered static functions to avoid compile issues

Daniel-Constantin Mierla miconda at gmail.com
Sat Jan 7 12:42:58 CET 2017


Module: kamailio
Branch: master
Commit: 040fea8c217b3a4dec90c59ce766553dcdf76507
URL: https://github.com/kamailio/kamailio/commit/040fea8c217b3a4dec90c59ce766553dcdf76507

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-01-07T12:42:19+01:00

jsonrpcs: reordered static functions to avoid compile issues

---

Modified: src/modules/jsonrpcs/jsonrpcs_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/040fea8c217b3a4dec90c59ce766553dcdf76507.diff
Patch: https://github.com/kamailio/kamailio/commit/040fea8c217b3a4dec90c59ce766553dcdf76507.patch

---

diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c
index ca67500..c641d0a 100644
--- a/src/modules/jsonrpcs/jsonrpcs_mod.c
+++ b/src/modules/jsonrpcs/jsonrpcs_mod.c
@@ -236,36 +236,6 @@ static void jsonrpc_reset_plain_reply(void (*free_fn)(void*))
 	memset(&_jsonrpc_plain_reply, 0, sizeof(jsonrpc_plain_reply_t));
 }
 
-/** Implementation of rpc_fault function required by the management API.
- *
- * This function will be called whenever a management function
- * indicates that an error ocurred while it was processing the request. The
- * function takes the reply code and reason phrase as parameters, these will
- * be put in the body of the reply.
- *
- * @param ctx A pointer to the context structure of the request being
- *            processed.
- * @param code Reason code.
- * @param fmt Formatting string used to build the reason phrase.
- */
-static void jsonrpc_fault(jsonrpc_ctx_t* ctx, int code, char* fmt, ...)
-{
-	va_list ap;
-
-	jsonrpc_delayed_reply_ctx_init(ctx);
-
-	ctx->http_code = code;
-	va_start(ap, fmt);
-	vsnprintf(jsonrpc_error_buf, JSONRPC_ERROR_REASON_BUF_LEN, fmt, ap);
-	va_end(ap);
-	ctx->http_text.len = strlen(jsonrpc_error_buf);
-	ctx->http_text.s = jsonrpc_error_buf;
-	if(ctx->error_code == 0) ctx->error_code = -32000;
-
-	return;
-}
-
-
 
 /** Initialize jsonrpc reply data structure.
  *
@@ -296,6 +266,50 @@ static int jsonrpc_init_reply(jsonrpc_ctx_t *ctx)
 	return 0;
 }
 
+
+/** if this a delayed reply context,
+ * and it's never been use before, initialize it */
+static int jsonrpc_delayed_reply_ctx_init(jsonrpc_ctx_t* ctx)
+{
+	if  ((ctx->flags & JSONRPC_DELAYED_CTX_F)
+			&& (ctx->jrpl==0)) {
+		if (jsonrpc_init_reply(ctx) < 0)
+			return -1;
+		jsonrpc_reset_plain_reply(ctx->jrpl->free_fn);
+	}
+	return 0;
+}
+
+/** Implementation of rpc_fault function required by the management API.
+ *
+ * This function will be called whenever a management function
+ * indicates that an error ocurred while it was processing the request. The
+ * function takes the reply code and reason phrase as parameters, these will
+ * be put in the body of the reply.
+ *
+ * @param ctx A pointer to the context structure of the request being
+ *            processed.
+ * @param code Reason code.
+ * @param fmt Formatting string used to build the reason phrase.
+ */
+static void jsonrpc_fault(jsonrpc_ctx_t* ctx, int code, char* fmt, ...)
+{
+	va_list ap;
+
+	jsonrpc_delayed_reply_ctx_init(ctx);
+
+	ctx->http_code = code;
+	va_start(ap, fmt);
+	vsnprintf(jsonrpc_error_buf, JSONRPC_ERROR_REASON_BUF_LEN, fmt, ap);
+	va_end(ap);
+	ctx->http_text.len = strlen(jsonrpc_error_buf);
+	ctx->http_text.s = jsonrpc_error_buf;
+	if(ctx->error_code == 0) ctx->error_code = -32000;
+
+	return;
+}
+
+
 /** Implementation of rpc_send function required by the management API.
  *
  * This is the function that will be called whenever a management function
@@ -918,19 +932,6 @@ static rpc_capabilities_t jsonrpc_capabilities(jsonrpc_ctx_t* ctx)
 	return RPC_DELAYED_REPLY;
 }
 
-/** if this a delayed reply context,
- * and it's never been use before, initialize it */
-static int jsonrpc_delayed_reply_ctx_init(jsonrpc_ctx_t* ctx)
-{
-	if  ((ctx->flags & JSONRPC_DELAYED_CTX_F)
-			&& (ctx->jrpl==0)) {
-		if (jsonrpc_init_reply(ctx) < 0)
-			return -1;
-		jsonrpc_reset_plain_reply(ctx->jrpl->free_fn);
-	}
-	return 0;
-}
-
 
 /** Returns a new "delayed reply" context.
  * Creates a new delayed reply context in shm and returns it.




More information about the sr-dev mailing list