1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 04:26:08 +02:00

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>
This commit is contained in:
Pavel Roskin 2006-07-10 02:57:51 -04:00 committed by Junio C Hamano
parent 82e5a82fd7
commit a9486b02ec
10 changed files with 33 additions and 31 deletions

View File

@ -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)
{

View File

@ -14,14 +14,15 @@
#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;

View 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];

View 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;

2
dir.c
View File

@ -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;

View 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);

View File

@ -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");

View 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;

View 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;

View 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);