]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Cleanup assumption that ALLOC could fail.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 19 Jun 2018 20:17:09 +0000 (16:17 -0400)
committerDavid Lamparter <equinox@opensourcerouting.org>
Sat, 11 Aug 2018 17:58:23 +0000 (19:58 +0200)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
tests/lib/test_heavy_thread.c
tests/lib/test_heavy_wq.c

index 075bcb6daf7b5c6c2abca54f4a2738a3684a4dad..b3c6e4c2f79073ca25a0259f97d8449b44fd046c 100644 (file)
@@ -110,16 +110,9 @@ DEFUN (clear_foo,
 
        str = argv_concat(argv, argc, 0);
 
-       if ((ws = XMALLOC(MTYPE_TMP, sizeof(*ws))) == NULL) {
-               zlog_err("%s: unable to allocate work_state", __func__);
-               return CMD_WARNING;
-       }
+       ws = XMALLOC(MTYPE_TMP, sizeof(*ws));
 
-       if (!(ws->str = XSTRDUP(MTYPE_TMP, str))) {
-               zlog_err("%s: unable to xstrdup", __func__);
-               XFREE(MTYPE_TMP, ws);
-               return CMD_WARNING;
-       }
+       ws->str = XSTRDUP(MTYPE_TMP, str);
 
        ws->vty = vty;
        ws->i = ITERS_FIRST;
index 0f474dc5d2d07710487a3e7ba18ae850d0ca678a..00ddc836d7cb80b63f7de6b92557ad4c410814da 100644 (file)
@@ -60,18 +60,10 @@ static void heavy_wq_add(struct vty *vty, const char *str, int i)
 {
        struct heavy_wq_node *hn;
 
-       if ((hn = XCALLOC(MTYPE_WQ_NODE, sizeof(struct heavy_wq_node)))
-           == NULL) {
-               zlog_err("%s: unable to allocate hn", __func__);
-               return;
-       }
+       hn = XCALLOC(MTYPE_WQ_NODE, sizeof(struct heavy_wq_node));
 
        hn->i = i;
-       if (!(hn->str = XSTRDUP(MTYPE_WQ_NODE_STR, str))) {
-               zlog_err("%s: unable to xstrdup", __func__);
-               XFREE(MTYPE_WQ_NODE, hn);
-               return;
-       }
+       hn->str = XSTRDUP(MTYPE_WQ_NODE_STR, str);
 
        work_queue_add(heavy_wq, hn);
 
@@ -149,10 +141,7 @@ DEFUN (clear_foo,
 
 static int heavy_wq_init()
 {
-       if (!(heavy_wq = work_queue_new(master, "heavy_work_queue"))) {
-               zlog_err("%s: could not get new work queue!", __func__);
-               return -1;
-       }
+       heavy_wq = work_queue_new(master, "heavy_work_queue");
 
        heavy_wq->spec.workfunc = &slow_func;
        heavy_wq->spec.errorfunc = &slow_func_err;