summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 08:47:23 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 08:47:23 +0200
commite9d4d3c505114114366cc0102ee92ce2e0d779dc (patch)
treeba4125df88d405f172c76f6eab00d6299d408bc1
parent58f6ac62aaf38b0122e304a09c2a589743a7e215 (diff)
downloadcalcurse-e9d4d3c505114114366cc0102ee92ce2e0d779dc.tar.gz
calcurse-e9d4d3c505114114366cc0102ee92ce2e0d779dc.zip
Do not use malloc() or xmalloc()
Use mem_malloc() instead which automatically picks the right implementation depending on whether memory debugging is enabled or not. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/calcurse.c8
-rw-r--r--src/listbox.c4
-rw-r--r--src/vector.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 6e4ea08..81f668d 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -276,10 +276,10 @@ static inline void key_generic_reload(void)
case 1:
break;
case 2:
- path_apts_backup = xmalloc(strlen(path_apts) +
- strlen(backup_ext) + 1);
- path_todo_backup = xmalloc(strlen(path_todo) +
- strlen(backup_ext) + 1);
+ path_apts_backup = mem_malloc(strlen(path_apts) +
+ strlen(backup_ext) + 1);
+ path_todo_backup = mem_malloc(strlen(path_todo) +
+ strlen(backup_ext) + 1);
sprintf(path_apts_backup, "%s%s", path_apts,
backup_ext);
sprintf(path_todo_backup, "%s%s", path_todo,
diff --git a/src/listbox.c b/src/listbox.c
index c886dce..a109b7f 100644
--- a/src/listbox.c
+++ b/src/listbox.c
@@ -97,8 +97,8 @@ void listbox_load_items(struct listbox *lb, int item_count)
free(lb->type);
free(lb->ch);
- lb->type = xmalloc(item_count * sizeof(unsigned));
- lb->ch = xmalloc((item_count + 1) * sizeof(unsigned));
+ lb->type = mem_malloc(item_count * sizeof(unsigned));
+ lb->ch = mem_malloc((item_count + 1) * sizeof(unsigned));
for (i = 0, ch = 0; i < item_count; i++) {
lb->type[i] = lb->fn_type(i, lb->cb_data);
lb->ch[i] = ch;
diff --git a/src/vector.c b/src/vector.c
index c1bab96..4e9713f 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -43,7 +43,7 @@ void vector_init(vector_t *v, unsigned size)
{
v->count = 0;
v->size = size;
- v->data = malloc(size * sizeof(void *));
+ v->data = mem_malloc(size * sizeof(void *));
}
/*