Browse Source

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

bel2125 7 years ago
parent
commit
83ba0bfdc3
1 changed files with 7 additions and 4 deletions
  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,
                 int timeout)
 {
+	int err, ret;
+	char txt[32]; /* will not overflow */
+	struct mg_context *octx;
+	struct mg_context rctx;
+
 	if (ebuf_len > 0) {
 		ebuf[0] = '\0';
 	}
@@ -15276,10 +15281,8 @@ mg_get_response(struct mg_connection *conn,
 	}
 
 	/* 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) {
 		mg_snprintf(conn, NULL, txt, sizeof(txt), "%i", timeout);