浏览代码

Move variable declaration to top of the function (C90 compatibility)

bel2125 7 年之前
父节点
当前提交
83ba0bfdc3
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/civetweb.c

+ 7 - 4
src/civetweb.c

@@ -15261,6 +15261,11 @@ mg_get_response(struct mg_connection *conn,
                 size_t ebuf_len,
                 size_t ebuf_len,
                 int timeout)
                 int timeout)
 {
 {
+	int err, ret;
+	char txt[32]; /* will not overflow */
+	struct mg_context *octx;
+	struct mg_context rctx;
+
 	if (ebuf_len > 0) {
 	if (ebuf_len > 0) {
 		ebuf[0] = '\0';
 		ebuf[0] = '\0';
 	}
 	}
@@ -15276,10 +15281,8 @@ mg_get_response(struct mg_connection *conn,
 	}
 	}
 
 
 	/* Implementation of API function for HTTP clients */
 	/* Implementation of API function for HTTP clients */
-	int err, ret;
-	struct mg_context *octx = conn->ctx;
-	struct mg_context rctx = *(conn->ctx);
-	char txt[32]; /* will not overflow */
+	*octx = conn->ctx;
+	rctx = *(conn->ctx);
 
 
 	if (timeout >= 0) {
 	if (timeout >= 0) {
 		mg_snprintf(conn, NULL, txt, sizeof(txt), "%i", timeout);
 		mg_snprintf(conn, NULL, txt, sizeof(txt), "%i", timeout);