@matheusbsbs / matheus-bagliano / commits / a9486b02ec
Fork 0

Avoid C99 comments, use old-style C comments instead.

This doesn't make the code uglier or harder to read, yet it makes the code more portable. This also simplifies checking for other potential incompatibilities. "gcc -std=c89 -pedantic" can flag many incompatible constructs as warnings, but C99 comments will cause it to emit an error. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Pavel Roskin committed Jul 10, 2006 at 02:57 UTC a9486b02ec7e03d17317fe538b0d06ca04379f23
10 files changed +33 -31
blame.c
+3 -3
@@ -44,8 +44,8 @@ struct util_info {
44 };
45
46 struct chunk {
47 - int off1, len1; // ---
48 - int off2, len2; // +++
47 + int off1, len1; /* --- */
48 + int off2, len2; /* +++ */
49 };
50
51 struct patch {
@@ -255,7 +255,7 @@ static void print_map(struct commit *cmit, struct commit *other)
255 }
256 #endif
257
258 -// p is a patch from commit to other.
258 +/* p is a patch from commit to other. */
259 static void fill_line_map(struct commit *commit, struct commit *other,
260 struct patch *p)
261 {
builtin-apply.c
+11 -10
@@ -14,14 +14,15 @@
14 #include "delta.h"
15 #include "builtin.h"
16
17 -// --check turns on checking that the working tree matches the
18 -// files that are being modified, but doesn't apply the patch
19 -// --stat does just a diffstat, and doesn't actually apply
20 -// --numstat does numeric diffstat, and doesn't actually apply
21 -// --index-info shows the old and new index info for paths if available.
22 -// --index updates the cache as well.
23 -// --cached updates only the cache without ever touching the working tree.
24 -//
17 +/*
18 + * --check turns on checking that the working tree matches the
19 + * files that are being modified, but doesn't apply the patch
20 + * --stat does just a diffstat, and doesn't actually apply
21 + * --numstat does numeric diffstat, and doesn't actually apply
22 + * --index-info shows the old and new index info for paths if available.
23 + * --index updates the cache as well.
24 + * --cached updates only the cache without ever touching the working tree.
25 + */
26 static const char *prefix;
27 static int prefix_length = -1;
28 static int newfd = -1;
@@ -284,8 +285,8 @@ static void parse_traditional_patch(const char *first, const char *second, struc
285 {
286 char *name;
287
287 - first += 4; // skip "--- "
288 - second += 4; // skip "+++ "
288 + first += 4; /* skip "--- " */
289 + second += 4; /* skip "+++ " */
290 if (is_dev_null(first)) {
291 patch->is_new = 1;
292 patch->is_delete = 0;
builtin-push.c
+1 -1
@@ -273,7 +273,7 @@ static int do_push(const char *repo)
273 int cmd_push(int argc, const char **argv, char **envp)
274 {
275 int i;
276 - const char *repo = "origin"; // default repository
276 + const char *repo = "origin"; /* default repository */
277
278 for (i = 1; i < argc; i++) {
279 const char *arg = argv[i];
convert-objects.c
+6 -6
@@ -240,14 +240,14 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
240 {
241 char *new = xmalloc(size + 100);
242 unsigned long newlen = 0;
243 -
244 - // "tree <sha1>\n"
243 +
244 + /* "tree <sha1>\n" */
245 memcpy(new + newlen, buffer, 46);
246 newlen += 46;
247 buffer = (char *) buffer + 46;
248 size -= 46;
249
250 - // "parent <sha1>\n"
250 + /* "parent <sha1>\n" */
251 while (!memcmp(buffer, "parent ", 7)) {
252 memcpy(new + newlen, buffer, 48);
253 newlen += 48;
@@ -255,12 +255,12 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
255 size -= 48;
256 }
257
258 - // "author xyz <xyz> date"
258 + /* "author xyz <xyz> date" */
259 newlen += convert_date_line(new + newlen, &buffer, &size);
260 - // "committer xyz <xyz> date"
260 + /* "committer xyz <xyz> date" */
261 newlen += convert_date_line(new + newlen, &buffer, &size);
262
263 - // Rest
263 + /* Rest */
264 memcpy(new + newlen, buffer, size);
265 newlen += size;
266
dir.c
+1 -1
@@ -336,7 +336,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
336 if (dir->show_other_directories &&
337 (subdir || !dir->hide_empty_directories) &&
338 !dir_exists(fullname, baselen + len)) {
339 - // Rewind the read subdirectory
339 + /* Rewind the read subdirectory */
340 while (dir->nr > rewind_base)
341 free(dir->entries[--dir->nr]);
342 break;
http-fetch.c
+3 -3
@@ -490,7 +490,7 @@ static int setup_index(struct alt_base *repo, unsigned char *sha1)
490 {
491 struct packed_git *new_pack;
492 if (has_pack_file(sha1))
493 - return 0; // don't list this as something we can get
493 + return 0; /* don't list this as something we can get */
494
495 if (fetch_index(repo, sha1))
496 return -1;
@@ -570,7 +570,7 @@ static void process_alternates_response(void *callback_data)
570 base[serverlen - 1] != '/');
571 i += 3;
572 }
573 - // If the server got removed, give up.
573 + /* If the server got removed, give up. */
574 okay = strchr(base, ':') - base + 3 <
575 serverlen;
576 } else if (alt_req->http_specific) {
@@ -581,7 +581,7 @@ static void process_alternates_response(void *callback_data)
581 okay = 1;
582 }
583 }
584 - // skip 'objects' at end
584 + /* skip 'objects' at end */
585 if (okay) {
586 target = xmalloc(serverlen + posn - i - 6);
587 strlcpy(target, base, serverlen);
mktag.c
+3 -2
@@ -17,7 +17,7 @@
17 * in that size, you're doing something wrong.
18 */
19
20 -// Some random size
20 +/* Some random size */
21 #define MAXSIZE (8192)
22
23 /*
@@ -123,7 +123,8 @@ int main(int argc, char **argv)
123 die("could not read from stdin");
124 }
125
126 - // Verify it for some basic sanity: it needs to start with "object <sha1>\ntype\ntagger "
126 + /* Verify it for some basic sanity: it needs to start with
127 + "object <sha1>\ntype\ntagger " */
128 if (verify_tag(buffer, size) < 0)
129 die("invalid tag signature file");
130
read-cache.c
+1 -1
@@ -748,7 +748,7 @@ int read_cache(void)
748 die("index file open failed (%s)", strerror(errno));
749 }
750
751 - size = 0; // avoid gcc warning
751 + size = 0; /* avoid gcc warning */
752 map = MAP_FAILED;
753 if (!fstat(fd, &st)) {
754 size = st.st_size;
sha1_file.c
+2 -2
@@ -453,7 +453,7 @@ int use_packed_git(struct packed_git *p)
453 {
454 if (!p->pack_size) {
455 struct stat st;
456 - // We created the struct before we had the pack
456 + /* We created the struct before we had the pack */
457 stat(p->pack_name, &st);
458 if (!S_ISREG(st.st_mode))
459 die("packfile %s not a regular file", p->pack_name);
@@ -1504,7 +1504,7 @@ static void *repack_object(const unsigned char *sha1, unsigned long *objsize)
1504 int hdrlen;
1505 void *buf;
1506
1507 - // need to unpack and recompress it by itself
1507 + /* need to unpack and recompress it by itself */
1508 unpacked = read_packed_sha1(sha1, type, &len);
1509
1510 hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
ssh-fetch.c
+2 -2
@@ -68,7 +68,7 @@ int fetch(unsigned char *sha1)
68 struct object_list *temp;
69
70 if (memcmp(sha1, in_transit->item->sha1, 20)) {
71 - // we must have already fetched it to clean the queue
71 + /* we must have already fetched it to clean the queue */
72 return has_sha1_file(sha1) ? 0 : -1;
73 }
74 prefetches--;
@@ -85,7 +85,7 @@ int fetch(unsigned char *sha1)
85 if (read(fd_in, &remote, 1) < 1)
86 return -1;
87 }
88 - //fprintf(stderr, "Got %d\n", remote);
88 + /* fprintf(stderr, "Got %d\n", remote); */
89 if (remote < 0)
90 return remote;
91 ret = write_sha1_from_fd(sha1, fd_in, conn_buf, 4096, &conn_buf_posn);