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:
parent
82e5a82fd7
commit
a9486b02ec
6
blame.c
6
blame.c
@ -44,8 +44,8 @@ struct util_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct chunk {
|
struct chunk {
|
||||||
int off1, len1; // ---
|
int off1, len1; /* --- */
|
||||||
int off2, len2; // +++
|
int off2, len2; /* +++ */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct patch {
|
struct patch {
|
||||||
@ -255,7 +255,7 @@ static void print_map(struct commit *cmit, struct commit *other)
|
|||||||
}
|
}
|
||||||
#endif
|
#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,
|
static void fill_line_map(struct commit *commit, struct commit *other,
|
||||||
struct patch *p)
|
struct patch *p)
|
||||||
{
|
{
|
||||||
|
@ -14,14 +14,15 @@
|
|||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
#include "builtin.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
|
* --check turns on checking that the working tree matches the
|
||||||
// --stat does just a diffstat, and doesn't actually apply
|
* files that are being modified, but doesn't apply the patch
|
||||||
// --numstat does numeric diffstat, and doesn't actually apply
|
* --stat does just a diffstat, and doesn't actually apply
|
||||||
// --index-info shows the old and new index info for paths if available.
|
* --numstat does numeric diffstat, and doesn't actually apply
|
||||||
// --index updates the cache as well.
|
* --index-info shows the old and new index info for paths if available.
|
||||||
// --cached updates only the cache without ever touching the working tree.
|
* --index updates the cache as well.
|
||||||
//
|
* --cached updates only the cache without ever touching the working tree.
|
||||||
|
*/
|
||||||
static const char *prefix;
|
static const char *prefix;
|
||||||
static int prefix_length = -1;
|
static int prefix_length = -1;
|
||||||
static int newfd = -1;
|
static int newfd = -1;
|
||||||
@ -284,8 +285,8 @@ static void parse_traditional_patch(const char *first, const char *second, struc
|
|||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
first += 4; // skip "--- "
|
first += 4; /* skip "--- " */
|
||||||
second += 4; // skip "+++ "
|
second += 4; /* skip "+++ " */
|
||||||
if (is_dev_null(first)) {
|
if (is_dev_null(first)) {
|
||||||
patch->is_new = 1;
|
patch->is_new = 1;
|
||||||
patch->is_delete = 0;
|
patch->is_delete = 0;
|
||||||
|
@ -273,7 +273,7 @@ static int do_push(const char *repo)
|
|||||||
int cmd_push(int argc, const char **argv, char **envp)
|
int cmd_push(int argc, const char **argv, char **envp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *repo = "origin"; // default repository
|
const char *repo = "origin"; /* default repository */
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
|
@ -240,14 +240,14 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
|
|||||||
{
|
{
|
||||||
char *new = xmalloc(size + 100);
|
char *new = xmalloc(size + 100);
|
||||||
unsigned long newlen = 0;
|
unsigned long newlen = 0;
|
||||||
|
|
||||||
// "tree <sha1>\n"
|
/* "tree <sha1>\n" */
|
||||||
memcpy(new + newlen, buffer, 46);
|
memcpy(new + newlen, buffer, 46);
|
||||||
newlen += 46;
|
newlen += 46;
|
||||||
buffer = (char *) buffer + 46;
|
buffer = (char *) buffer + 46;
|
||||||
size -= 46;
|
size -= 46;
|
||||||
|
|
||||||
// "parent <sha1>\n"
|
/* "parent <sha1>\n" */
|
||||||
while (!memcmp(buffer, "parent ", 7)) {
|
while (!memcmp(buffer, "parent ", 7)) {
|
||||||
memcpy(new + newlen, buffer, 48);
|
memcpy(new + newlen, buffer, 48);
|
||||||
newlen += 48;
|
newlen += 48;
|
||||||
@ -255,12 +255,12 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
|
|||||||
size -= 48;
|
size -= 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "author xyz <xyz> date"
|
/* "author xyz <xyz> date" */
|
||||||
newlen += convert_date_line(new + newlen, &buffer, &size);
|
newlen += convert_date_line(new + newlen, &buffer, &size);
|
||||||
// "committer xyz <xyz> date"
|
/* "committer xyz <xyz> date" */
|
||||||
newlen += convert_date_line(new + newlen, &buffer, &size);
|
newlen += convert_date_line(new + newlen, &buffer, &size);
|
||||||
|
|
||||||
// Rest
|
/* Rest */
|
||||||
memcpy(new + newlen, buffer, size);
|
memcpy(new + newlen, buffer, size);
|
||||||
newlen += size;
|
newlen += size;
|
||||||
|
|
||||||
|
2
dir.c
2
dir.c
@ -336,7 +336,7 @@ static int read_directory_recursive(struct dir_struct *dir, const char *path, co
|
|||||||
if (dir->show_other_directories &&
|
if (dir->show_other_directories &&
|
||||||
(subdir || !dir->hide_empty_directories) &&
|
(subdir || !dir->hide_empty_directories) &&
|
||||||
!dir_exists(fullname, baselen + len)) {
|
!dir_exists(fullname, baselen + len)) {
|
||||||
// Rewind the read subdirectory
|
/* Rewind the read subdirectory */
|
||||||
while (dir->nr > rewind_base)
|
while (dir->nr > rewind_base)
|
||||||
free(dir->entries[--dir->nr]);
|
free(dir->entries[--dir->nr]);
|
||||||
break;
|
break;
|
||||||
|
@ -490,7 +490,7 @@ static int setup_index(struct alt_base *repo, unsigned char *sha1)
|
|||||||
{
|
{
|
||||||
struct packed_git *new_pack;
|
struct packed_git *new_pack;
|
||||||
if (has_pack_file(sha1))
|
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))
|
if (fetch_index(repo, sha1))
|
||||||
return -1;
|
return -1;
|
||||||
@ -570,7 +570,7 @@ static void process_alternates_response(void *callback_data)
|
|||||||
base[serverlen - 1] != '/');
|
base[serverlen - 1] != '/');
|
||||||
i += 3;
|
i += 3;
|
||||||
}
|
}
|
||||||
// If the server got removed, give up.
|
/* If the server got removed, give up. */
|
||||||
okay = strchr(base, ':') - base + 3 <
|
okay = strchr(base, ':') - base + 3 <
|
||||||
serverlen;
|
serverlen;
|
||||||
} else if (alt_req->http_specific) {
|
} else if (alt_req->http_specific) {
|
||||||
@ -581,7 +581,7 @@ static void process_alternates_response(void *callback_data)
|
|||||||
okay = 1;
|
okay = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// skip 'objects' at end
|
/* skip 'objects' at end */
|
||||||
if (okay) {
|
if (okay) {
|
||||||
target = xmalloc(serverlen + posn - i - 6);
|
target = xmalloc(serverlen + posn - i - 6);
|
||||||
strlcpy(target, base, serverlen);
|
strlcpy(target, base, serverlen);
|
||||||
|
5
mktag.c
5
mktag.c
@ -17,7 +17,7 @@
|
|||||||
* in that size, you're doing something wrong.
|
* in that size, you're doing something wrong.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Some random size
|
/* Some random size */
|
||||||
#define MAXSIZE (8192)
|
#define MAXSIZE (8192)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -123,7 +123,8 @@ int main(int argc, char **argv)
|
|||||||
die("could not read from stdin");
|
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)
|
if (verify_tag(buffer, size) < 0)
|
||||||
die("invalid tag signature file");
|
die("invalid tag signature file");
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ int read_cache(void)
|
|||||||
die("index file open failed (%s)", strerror(errno));
|
die("index file open failed (%s)", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 0; // avoid gcc warning
|
size = 0; /* avoid gcc warning */
|
||||||
map = MAP_FAILED;
|
map = MAP_FAILED;
|
||||||
if (!fstat(fd, &st)) {
|
if (!fstat(fd, &st)) {
|
||||||
size = st.st_size;
|
size = st.st_size;
|
||||||
|
@ -453,7 +453,7 @@ int use_packed_git(struct packed_git *p)
|
|||||||
{
|
{
|
||||||
if (!p->pack_size) {
|
if (!p->pack_size) {
|
||||||
struct stat st;
|
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);
|
stat(p->pack_name, &st);
|
||||||
if (!S_ISREG(st.st_mode))
|
if (!S_ISREG(st.st_mode))
|
||||||
die("packfile %s not a regular file", p->pack_name);
|
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;
|
int hdrlen;
|
||||||
void *buf;
|
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);
|
unpacked = read_packed_sha1(sha1, type, &len);
|
||||||
|
|
||||||
hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
|
hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
|
||||||
|
@ -68,7 +68,7 @@ int fetch(unsigned char *sha1)
|
|||||||
struct object_list *temp;
|
struct object_list *temp;
|
||||||
|
|
||||||
if (memcmp(sha1, in_transit->item->sha1, 20)) {
|
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;
|
return has_sha1_file(sha1) ? 0 : -1;
|
||||||
}
|
}
|
||||||
prefetches--;
|
prefetches--;
|
||||||
@ -85,7 +85,7 @@ int fetch(unsigned char *sha1)
|
|||||||
if (read(fd_in, &remote, 1) < 1)
|
if (read(fd_in, &remote, 1) < 1)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//fprintf(stderr, "Got %d\n", remote);
|
/* fprintf(stderr, "Got %d\n", remote); */
|
||||||
if (remote < 0)
|
if (remote < 0)
|
||||||
return remote;
|
return remote;
|
||||||
ret = write_sha1_from_fd(sha1, fd_in, conn_buf, 4096, &conn_buf_posn);
|
ret = write_sha1_from_fd(sha1, fd_in, conn_buf, 4096, &conn_buf_posn);
|
||||||
|
Loading…
Reference in New Issue
Block a user