commit 439cb506b82b3ff36a6855d45642051e7775e698
parent 9ecd584711c6e08a89f24604621bbfc2e341dfd2
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date: Thu, 19 Jun 2014 16:29:27 -0400
some cleaning
objects.c: replace calloc() with malloc()
dircache-simple.c: remove extra free for same pointer
Diffstat:
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dircache-simple.c b/dircache-simple.c
@@ -497,7 +497,6 @@ simple_commit(struct dircache_ctx *dc_ctx, const char *msgfile)
fprintf(fp, "%c %s %06o", 'D', objid, s.st_mode);
fclose(fp);
}
- free(path);
fclose(didx_fp);
unlink(didx_path);
/* temp */
diff --git a/objects.c b/objects.c
@@ -22,7 +22,8 @@
struct file*
baseline_file_new()
{
- struct file *file = (struct file *)calloc(1, sizeof(struct file));
+ struct file *file = (struct file *)malloc(sizeof(struct file));
+ file->id = NULL;
return file;
}
@@ -40,7 +41,13 @@ baseline_file_free(struct file *file)
struct commit*
baseline_commit_new()
{
- struct commit *comm = (struct commit *)calloc(1, sizeof(struct commit));
+ struct commit *comm = (struct commit *)malloc(sizeof(struct commit));
+ comm->id = NULL;
+ comm->dir = NULL;
+ comm->author.name = NULL;
+ comm->author.email = NULL;
+ comm->n_parents = 0;
+ comm->message = NULL;
return comm;
}
@@ -61,7 +68,9 @@ baseline_commit_free(struct commit *comm)
struct dir*
baseline_dir_new()
{
- struct dir *dir = (struct dir *)calloc(1, sizeof(struct dir));
+ struct dir *dir = (struct dir *)malloc(sizeof(struct dir));
+ dir->id = NULL;
+ dir->parent = NULL;
dir->children = NULL;
return dir;
}