From 32a255f47c5dd75a9840d356493ffc275549dd4b Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 24 Oct 2010 13:06:23 +0000 Subject: [PATCH] tmalloc usage, minor usage unification --- ChangeLog | 6 ++++++ src/frontend/com_display.c | 2 +- src/frontend/device.c | 4 ++-- src/frontend/help/x11disp.c | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef318005b..fe0c5ecf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-10-24 Robert Larice + * src/frontend/com_display.c , + * src/frontend/device.c , + * src/frontend/help/x11disp.c : + tmalloc usage, minor usage unification + 2010-10-24 Robert Larice * src/frontend/com_sysinfo.c , * src/frontend/plotting/graf.c , diff --git a/src/frontend/com_display.c b/src/frontend/com_display.c index 1a4f8a040..fb53c8e3a 100644 --- a/src/frontend/com_display.c +++ b/src/frontend/com_display.c @@ -61,7 +61,7 @@ com_display(wordlist *wl) return; } out_printf("Here are the vectors currently active:\n\n"); - dvs = (struct dvec **) tmalloc(len * (sizeof (struct dvec *))); + dvs = (struct dvec **) tmalloc(len * sizeof(struct dvec *)); for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++) dvs[i] = d; if (!cp_getvar("nosort", CP_BOOL, NULL)) diff --git a/src/frontend/device.c b/src/frontend/device.c index 4b75fb1d8..e55da1cb6 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -917,8 +917,8 @@ com_alter_common(wordlist *wl, int do_model) eqfound = TRUE; arglist = (char**)tmalloc(4*sizeof(char*)); arglist[3] = NULL; - arglist[0] = (char*)tmalloc(i*sizeof(char) + 1); - arglist[2] = (char*)tmalloc(strlen(&argument[i+1])*sizeof(char) + 1); + arglist[0] = (char*)tmalloc(i + 1); + arglist[2] = (char*)tmalloc(strlen(&argument[i+1]) + 1); /* copy argument */ strncpy(arglist[0],argument,i); arglist[0][i] = '\0'; diff --git a/src/frontend/help/x11disp.c b/src/frontend/help/x11disp.c index 06775ac04..c336c5b93 100644 --- a/src/frontend/help/x11disp.c +++ b/src/frontend/help/x11disp.c @@ -164,7 +164,7 @@ hlp_xdisplay(topic *top) commandWidgetClass, top->subboxwidget, buttonargs, XtNumber(buttonargs)); /* core leak XXX */ - hand = (handle *) tmalloc(sizeof (struct handle)); + hand = (handle *) tmalloc(sizeof (handle)); hand->result = tl; hand->parent = top; XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) newtopic, hand); @@ -196,7 +196,7 @@ hlp_xdisplay(topic *top) XtSetArg(buttonargs[0], XtNlabel, tl->button.text); buttonwidget = XtCreateManagedWidget(tl->button.text, commandWidgetClass, top->seeboxwidget, buttonargs, 1); - hand = (handle *) tmalloc(sizeof (struct handle)); + hand = (handle *) tmalloc(sizeof (handle)); /* core leak XXX */ hand->result = tl; hand->parent = top;