Skip to content

Commit

Permalink
Get rid of free_multi()
Browse files Browse the repository at this point in the history
In fact, it causes a lot of problem. Seems to work at first glance, but I was wrong, more tests prove it's buggy. Only used once now, can be removed...
  • Loading branch information
TheTumultuousUnicornOfDarkness committed Oct 21, 2016
1 parent bc37dec commit 9333921
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
3 changes: 0 additions & 3 deletions src/cpu-x.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ char *msg_error(char *color, char *file, int line, char *str);
casprintf(&str, true, "%i KB %i-way", -1, 12): str = "12-way" */
int casprintf(char **str, bool clean_str, const char *fmt, ...);

/* Try to free given variables */
void free_multi(void *var, ...);

/* Return a formatted string */
char *format(char *str, ...);

Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ static void sighandler(int signum)
MSG_STDERR("https://github.com/X0rg/CPU-X/issues/new\n");

/* Stop program */
free_multi(bt_syms, bt);
free(bt_syms);
signal(signum, SIG_DFL);
kill(getpid(), signum);
}
Expand Down
19 changes: 0 additions & 19 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,6 @@ int casprintf(char **str, bool clean_str, const char *fmt, ...)
return j;
}

/* Try to free given variables */
void free_multi(void *var, ...)
{
void *ptr, *sentinel = NULL;
va_list aptr;

va_start(aptr, var);
free(var);

while((ptr = va_arg(aptr, void *)) != NULL && ptr != sentinel)
{
if(sentinel == NULL)
sentinel = ptr;
free(ptr);
}

va_end(aptr);
}

/* Return a formatted string */
char *format(char *str, ...)
{
Expand Down

0 comments on commit 9333921

Please sign in to comment.