瀏覽代碼

jsonrpcs: reordered static functions to avoid compile issues

Daniel-Constantin Mierla 8 年之前
父節點
當前提交
040fea8c21
共有 1 個文件被更改,包括 44 次插入43 次删除
  1. 44 43
      src/modules/jsonrpcs/jsonrpcs_mod.c

+ 44 - 43
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));
 	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.
 /** Initialize jsonrpc reply data structure.
  *
  *
@@ -296,6 +266,50 @@ static int jsonrpc_init_reply(jsonrpc_ctx_t *ctx)
 	return 0;
 	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.
 /** Implementation of rpc_send function required by the management API.
  *
  *
  * This is the function that will be called whenever a management function
  * 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;
 	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.
 /** Returns a new "delayed reply" context.
  * Creates a new delayed reply context in shm and returns it.
  * Creates a new delayed reply context in shm and returns it.