http-push.c: squelch C90 warnings.
If you write code after declarations in a block, gcc scolds you with "warning: ISO C90 forbids mixed declarations and code". Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Mar 21, 2006 at 15:49 UTC
8c9e7947c2a76fb21bda11816c544d50e271156d
1 file changed
+12
-8
http-push.c
+12
-8
@@ -1863,6 +1863,7 @@ static void one_remote_ref(char *refname)
1863
struct ref *ref;
1864
unsigned char remote_sha1[20];
1865
struct object *obj;
1866
+ int len = strlen(refname) + 1;
1867
1868
if (fetch_ref(refname, remote_sha1) != 0) {
1869
fprintf(stderr,
@@ -1884,7 +1885,6 @@ static void one_remote_ref(char *refname)
1885
}
1886
}
1887
1887
- int len = strlen(refname) + 1;
1888
ref = xcalloc(1, sizeof(*ref) + len);
1889
memcpy(ref->old_sha1, remote_sha1, 20);
1890
memcpy(ref->name, refname, len);
@@ -2313,6 +2313,8 @@ int main(int argc, char **argv)
2313
int objects_to_send;
2314
int rc = 0;
2315
int i;
2316
+ int new_refs;
2317
+ struct ref *ref;
2318
2319
setup_git_directory();
2320
setup_ident();
@@ -2347,8 +2349,8 @@ int main(int argc, char **argv)
2349
}
2350
}
2351
if (!remote->url) {
2350
- remote->url = arg;
2352
char *path = strstr(arg, "//");
2353
+ remote->url = arg;
2354
if (path) {
2355
path = index(path+2, '/');
2356
if (path)
@@ -2421,10 +2423,13 @@ int main(int argc, char **argv)
2423
return 0;
2424
}
2425
2424
- int new_refs = 0;
2425
- struct ref *ref;
2426
+ new_refs = 0;
2427
for (ref = remote_refs; ref; ref = ref->next) {
2428
char old_hex[60], *new_hex;
2429
+ const char *commit_argv[4];
2430
+ int commit_argc;
2431
+ char *new_sha1_hex, *old_sha1_hex;
2432
+
2433
if (!ref->peer_ref)
2434
continue;
2435
if (!memcmp(ref->old_sha1, ref->peer_ref->new_sha1, 20)) {
@@ -2482,10 +2487,9 @@ int main(int argc, char **argv)
2487
}
2488
2489
/* Set up revision info for this refspec */
2485
- const char *commit_argv[4];
2486
- int commit_argc = 3;
2487
- char *new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
2488
- char *old_sha1_hex = NULL;
2490
+ commit_argc = 3;
2491
+ new_sha1_hex = strdup(sha1_to_hex(ref->new_sha1));
2492
+ old_sha1_hex = NULL;
2493
commit_argv[1] = "--objects";
2494
commit_argv[2] = new_sha1_hex;
2495
if (!push_all && !is_zero_sha1(ref->old_sha1)) {