summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef11862)
raw | patch | inline | side by side (parent: ef11862)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 31 Aug 2006 22:32:39 +0000 (00:32 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 31 Aug 2006 23:24:39 +0000 (16:24 -0700) |
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-fmt-merge-msg.c | patch | blob | history | |
builtin-repo-config.c | patch | blob | history | |
config.c | patch | blob | history | |
git.c | patch | blob | history | |
help.c | patch | blob | history | |
merge-recursive.c | patch | blob | history | |
mktag.c | patch | blob | history | |
send-pack.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index 76d22b47ba2906ecb59f0d8e279cf55a80bf8c86..ed59e77e1923ee8f0df050dd6851b805a26127a2 100644 (file)
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
if (!strcmp(".", src) || !strcmp(src, origin)) {
int len = strlen(origin);
if (origin[0] == '\'' && origin[len - 1] == '\'') {
- char *new_origin = malloc(len - 1);
+ char *new_origin = xmalloc(len - 1);
memcpy(new_origin, origin + 1, len - 2);
new_origin[len - 1] = 0;
origin = new_origin;
} else
origin = strdup(origin);
} else {
- char *new_origin = malloc(strlen(origin) + strlen(src) + 5);
+ char *new_origin = xmalloc(strlen(origin) + strlen(src) + 5);
sprintf(new_origin, "%s of %s", origin, src);
origin = new_origin;
}
if (eol) {
int len = eol - bol;
- oneline = malloc(len + 1);
+ oneline = xmalloc(len + 1);
memcpy(oneline, bol, len);
oneline[len] = 0;
} else
diff --git a/builtin-repo-config.c b/builtin-repo-config.c
index 6560cf1c2dd04a1ef047767a69a68bac794d7187..a1756c85803f9444fd6154511640d9b3b0da07e7 100644 (file)
--- a/builtin-repo-config.c
+++ b/builtin-repo-config.c
*tl = tolower(*tl);
if (use_key_regexp) {
- key_regexp = (regex_t*)malloc(sizeof(regex_t));
+ key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(key_regexp, key, REG_EXTENDED)) {
fprintf(stderr, "Invalid key pattern: %s\n", key_);
goto free_strings;
regex_++;
}
- regexp = (regex_t*)malloc(sizeof(regex_t));
+ regexp = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(regexp, regex_, REG_EXTENDED)) {
fprintf(stderr, "Invalid pattern: %s\n", regex_);
goto free_strings;
diff --git a/config.c b/config.c
index d9f2b787b94f2506ff7842c1b7b06bd15342ba6f..c0897cc8076cfa62cd7e5b41513ae33c28e53dde 100644 (file)
--- a/config.c
+++ b/config.c
/*
* Validate the key and while at it, lower case it for matching.
*/
- store.key = (char*)malloc(strlen(key)+1);
+ store.key = xmalloc(strlen(key) + 1);
dot = 0;
for (i = 0; key[i]; i++) {
unsigned char c = key[i];
} else
store.do_not_match = 0;
- store.value_regex = (regex_t*)malloc(sizeof(regex_t));
+ store.value_regex = (regex_t*)xmalloc(sizeof(regex_t));
if (regcomp(store.value_regex, value_regex,
REG_EXTENDED)) {
fprintf(stderr, "Invalid pattern: %s\n",
index bd07289d71a75ad0280bae21c64c4c4be86f80d2..05871ad42c8c20999e2dd977ea6033f38614e862 100644 (file)
--- a/git.c
+++ b/git.c
path_len = len + strlen(old_path) + 1;
- path = malloc(path_len + 1);
+ path = xmalloc(path_len + 1);
memcpy(path, dir, len);
path[len] = ':';
index 9ecdefdb03be7fac8d9283c93f2320f71bd062d6..0824c25226ad7b106e56d1b7c23fad40eed92749 100644 (file)
--- a/help.c
+++ b/help.c
page = git_cmd;
else {
int page_len = strlen(git_cmd) + 4;
- char *p = malloc(page_len + 1);
+ char *p = xmalloc(page_len + 1);
strcpy(p, "git-");
strcpy(p + 4, git_cmd);
p[page_len] = 0;
diff --git a/merge-recursive.c b/merge-recursive.c
index 39a1eae894398cd235a1dfb643c523823670f656..48b2763de6892be60ab6be8a6e490d15e4ff81ac 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
unsigned int mode, int stage)
{
int len = strlen(path);
- char *newpath = malloc(baselen + len + 1);
+ char *newpath = xmalloc(baselen + len + 1);
memcpy(newpath, base, baselen);
memcpy(newpath + baselen, path, len);
newpath[baselen + len] = '\0';
if (ret)
return ret;
len = strlen(name);
- dirs = malloc(len+1);
+ dirs = xmalloc(len+1);
memcpy(dirs, name, len);
dirs[len] = '\0';
while ((slash = strrchr(name, '/'))) {
flush_buffer(fd, buf, size);
close(fd);
} else if (S_ISLNK(mode)) {
- char *lnk = malloc(size + 1);
+ char *lnk = xmalloc(size + 1);
memcpy(lnk, buf, size);
lnk[size] = '\0';
mkdir_p(path, 0777);
index be23e589fbf504cb165abc3b97bdf5adb7317f68..3448a5dde7cbd795b08db872180f03dcfb66b99a 100644 (file)
--- a/mktag.c
+++ b/mktag.c
int main(int argc, char **argv)
{
unsigned long size = 4096;
- char *buffer = malloc(size);
+ char *buffer = xmalloc(size);
unsigned char result_sha1[20];
if (argc != 1)
diff --git a/send-pack.c b/send-pack.c
index fd79a61923ddc20af216ccd252e40bf38a70eccb..ac4501d34154301030cf98ff122eb233095417b7 100644 (file)
--- a/send-pack.c
+++ b/send-pack.c
if (900 < i)
die("git-rev-list environment overflow");
if (!is_zero_sha1(ref->new_sha1)) {
- char *buf = malloc(100);
+ char *buf = xmalloc(100);
args[i++] = buf;
snprintf(buf, 50, "%s", sha1_to_hex(ref->new_sha1));
buf += 50;
if (is_zero_sha1(ref->new_sha1) &&
!is_zero_sha1(ref->old_sha1) &&
has_sha1_file(ref->old_sha1)) {
- char *buf = malloc(42);
+ char *buf = xmalloc(42);
args[i++] = buf;
snprintf(buf, 42, "^%s", sha1_to_hex(ref->old_sha1));
}
diff --git a/sha1_file.c b/sha1_file.c
index 46272b591645e444396ae683673620594f336a7c..af2bf72babcec71ff1a012c2baeedc089743ad4b 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object)
{
unsigned long size = 4096;
- char *buf = malloc(size);
+ char *buf = xmalloc(size);
int ret;
unsigned char hdr[50];
int hdrlen;