aboutsummaryrefslogtreecommitdiff
path: root/spectrogram.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-02 18:11:30 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-02 18:11:30 +0000
commite5400522430da40e678270f50a2c9eaa12fb8c1b (patch)
tree687e26c8c104a4d92aadf408ac0a47dd6e6045ba /spectrogram.c
parent56b9322a73bd3e4f9974b80fdc64bcb863913073 (diff)
simplify fft, switch to assert by malloc
Diffstat (limited to 'spectrogram.c')
-rw-r--r--spectrogram.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/spectrogram.c b/spectrogram.c
index 62812e3..e5232c7 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <sys/time.h>
+#include <assert.h>
#include <err.h>
#include <math.h>
#include <signal.h>
@@ -103,8 +104,7 @@ init_palette(Display *d, struct palette pal, int n)
int i;
p = calloc(n, sizeof(unsigned long));
- if (!p)
- errx(1, "malloc failed");
+ assert(p);
hstep = (pal.to.h - pal.from.h) / n;
sstep = (pal.to.s - pal.from.s) / n;
@@ -239,12 +239,10 @@ init_panel(Display *d, Window win, int x, int y, int w, int h, int mirror)
unsigned long *palette;
p = malloc(sizeof(struct panel));
- if (!p)
- errx(1, "malloc failed");
+ assert(p);
p->data = calloc(w, sizeof(double));
- if (!p->data)
- errx(1, "malloc failed");
+ assert(p->data);
/* main panel window */
p->win = XCreateSimpleWindow(d, win, x, y, w, h, 0, white, gray);