Avoid C99 comments, use old-style C comments instead.
authorPavel Roskin <proski@gnu.org>
Mon, 10 Jul 2006 06:57:51 +0000 (02:57 -0400)
committerJunio C Hamano <junkio@cox.net>
Mon, 10 Jul 2006 07:47:13 +0000 (00:47 -0700)
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>
blame.c
builtin-apply.c
builtin-push.c
convert-objects.c
dir.c
http-fetch.c
mktag.c
read-cache.c
sha1_file.c
ssh-fetch.c
diff --git a/blame.c b/blame.c
index 0a06026168458de494f1cd089ea58470af4f3e56..b04b8f58aaf718208ab13e5cbfd8cd2a4444cbd7 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -44,8 +44,8 @@ struct util_info {
 };
 
 struct chunk {
-       int off1, len1; // ---
-       int off2, len2; // +++
+       int off1, len1; /* --- */
+       int off2, len2; /* +++ */
 };
 
 struct patch {
@@ -255,7 +255,7 @@ static void print_map(struct commit *cmit, struct commit *other)
 }
 #endif
 
-// p is a patch from commit to other.
+/* p is a patch from commit to other. */
 static void fill_line_map(struct commit *commit, struct commit *other,
                          struct patch *p)
 {
index 1e5b846dd3935f54ee8fa1c3620810be059de5d3..c903146bb65e6db4dcb527badf864d98db6aabb3 100644 (file)
 #include "delta.h"
 #include "builtin.h"
 
-//  --check turns on checking that the working tree matches the
-//    files that are being modified, but doesn't apply the patch
-//  --stat does just a diffstat, and doesn't actually apply
-//  --numstat does numeric diffstat, and doesn't actually apply
-//  --index-info shows the old and new index info for paths if available.
-//  --index updates the cache as well.
-//  --cached updates only the cache without ever touching the working tree.
-//
+/*
+ *  --check turns on checking that the working tree matches the
+ *    files that are being modified, but doesn't apply the patch
+ *  --stat does just a diffstat, and doesn't actually apply
+ *  --numstat does numeric diffstat, and doesn't actually apply
+ *  --index-info shows the old and new index info for paths if available.
+ *  --index updates the cache as well.
+ *  --cached updates only the cache without ever touching the working tree.
+ */
 static const char *prefix;
 static int prefix_length = -1;
 static int newfd = -1;
@@ -284,8 +285,8 @@ static void parse_traditional_patch(const char *first, const char *second, struc
 {
        char *name;
 
-       first += 4;     // skip "--- "
-       second += 4;    // skip "+++ "
+       first += 4;     /* skip "--- " */
+       second += 4;    /* skip "+++ " */
        if (is_dev_null(first)) {
                patch->is_new = 1;
                patch->is_delete = 0;
index a8fac886f1a35dd645a513be70cb6c368f75437d..31cbfd73861326ad303472718365838329a55cb8 100644 (file)
@@ -273,7 +273,7 @@ static int do_push(const char *repo)
 int cmd_push(int argc, const char **argv, char **envp)
 {
        int i;
-       const char *repo = "origin";    // default repository
+       const char *repo = "origin";    /* default repository */
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
index 0fabd8981c6047e5144cfb3776b4f4a5588f24e5..ebea8e472bb2eede02219999b0cfd9a63f211d4b 100644 (file)
@@ -240,14 +240,14 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
 {
        char *new = xmalloc(size + 100);
        unsigned long newlen = 0;
-       
-       // "tree <sha1>\n"
+
+       /* "tree <sha1>\n" */
        memcpy(new + newlen, buffer, 46);
        newlen += 46;
        buffer = (char *) buffer + 46;
        size -= 46;
 
-       // "parent <sha1>\n"
+       /* "parent <sha1>\n" */
        while (!memcmp(buffer, "parent ", 7)) {
                memcpy(new + newlen, buffer, 48);
                newlen += 48;
@@ -255,12 +255,12 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
                size -= 48;
        }
 
-       // "author xyz <xyz> date"
+       /* "author xyz <xyz> date" */
        newlen += convert_date_line(new + newlen, &buffer, &size);
-       // "committer xyz <xyz> date"
+       /* "committer xyz <xyz> date" */
        newlen += convert_date_line(new + newlen, &buffer, &size);
 
-       // Rest
+       /* Rest */
        memcpy(new + newlen, buffer, size);
        newlen += size;
 
diff --git a/dir.c b/dir.c
index d778ecd8908d7a32519cc9c31d8333de3fad0ae6..092d07736c60d4c6d86201ebeb841498c3be92a0 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -336,7 +336,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
                                if (dir->show_other_directories &&
                                    (subdir || !dir->hide_empty_directories) &&
                                    !dir_exists(fullname, baselen + len)) {
-                                       // Rewind the read subdirectory
+                                       /* Rewind the read subdirectory */
                                        while (dir->nr > rewind_base)
                                                free(dir->entries[--dir->nr]);
                                        break;
index 44eba5fd0df292255dce056ec5aa700186096b39..12493fbed2822ce41b5b4c23fb85d6f4a47c104a 100644 (file)
@@ -490,7 +490,7 @@ static int setup_index(struct alt_base *repo, unsigned char *sha1)
 {
        struct packed_git *new_pack;
        if (has_pack_file(sha1))
-               return 0; // don't list this as something we can get
+               return 0; /* don't list this as something we can get */
 
        if (fetch_index(repo, sha1))
                return -1;
@@ -570,7 +570,7 @@ static void process_alternates_response(void *callback_data)
                                                 base[serverlen - 1] != '/');
                                        i += 3;
                                }
-                               // If the server got removed, give up.
+                               /* If the server got removed, give up. */
                                okay = strchr(base, ':') - base + 3 <
                                        serverlen;
                        } else if (alt_req->http_specific) {
@@ -581,7 +581,7 @@ static void process_alternates_response(void *callback_data)
                                        okay = 1;
                                }
                        }
-                       // skip 'objects' at end
+                       /* skip 'objects' at end */
                        if (okay) {
                                target = xmalloc(serverlen + posn - i - 6);
                                strlcpy(target, base, serverlen);
diff --git a/mktag.c b/mktag.c
index f0fe5285b24d5a19c7d41b437a18a3851ae90802..27f4c4f0413c5a7bb16106d1a0c1d5381c1159d2 100644 (file)
--- a/mktag.c
+++ b/mktag.c
@@ -17,7 +17,7 @@
  * in that size, you're doing something wrong.
  */
 
-// Some random size
+/* Some random size */
 #define MAXSIZE (8192)
 
 /*
@@ -123,7 +123,8 @@ int main(int argc, char **argv)
                die("could not read from stdin");
        }
 
-       // Verify it for some basic sanity: it needs to start with "object <sha1>\ntype\ntagger "
+       /* Verify it for some basic sanity: it needs to start with
+          "object <sha1>\ntype\ntagger " */
        if (verify_tag(buffer, size) < 0)
                die("invalid tag signature file");
 
index 3c32aae7e8ae63bccad83a603f2b86c66965cd26..a50d3612c84d10da35b0b0e1278ecea899a4ec15 100644 (file)
@@ -748,7 +748,7 @@ int read_cache(void)
                die("index file open failed (%s)", strerror(errno));
        }
 
-       size = 0; // avoid gcc warning
+       size = 0; /* avoid gcc warning */
        map = MAP_FAILED;
        if (!fstat(fd, &st)) {
                size = st.st_size;
index f7bb3a1c54c001a83dd0c2ee9c2b59dd686a66d1..459430a56c10df4ad02195ef83d289b753222ffc 100644 (file)
@@ -453,7 +453,7 @@ int use_packed_git(struct packed_git *p)
 {
        if (!p->pack_size) {
                struct stat st;
-               // We created the struct before we had the pack
+               /* We created the struct before we had the pack */
                stat(p->pack_name, &st);
                if (!S_ISREG(st.st_mode))
                        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)
        int hdrlen;
        void *buf;
 
-       // need to unpack and recompress it by itself
+       /* need to unpack and recompress it by itself */
        unpacked = read_packed_sha1(sha1, type, &len);
 
        hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
index 1e59cd2008d8089efef74b940d1a1094add7e687..28f7fd9174e8c48493983b17fa7b18cdecd41609 100644 (file)
@@ -68,7 +68,7 @@ int fetch(unsigned char *sha1)
        struct object_list *temp;
 
        if (memcmp(sha1, in_transit->item->sha1, 20)) {
-               // we must have already fetched it to clean the queue
+               /* we must have already fetched it to clean the queue */
                return has_sha1_file(sha1) ? 0 : -1;
        }
        prefetches--;
@@ -85,7 +85,7 @@ int fetch(unsigned char *sha1)
                if (read(fd_in, &remote, 1) < 1)
                        return -1;
        }
-       //fprintf(stderr, "Got %d\n", remote);
+       /* fprintf(stderr, "Got %d\n", remote); */
        if (remote < 0)
                return remote;
        ret = write_sha1_from_fd(sha1, fd_in, conn_buf, 4096, &conn_buf_posn);