[hipl-dev] Re: [Merge] lp:~hipl-core/hipl/libhip into lp:hipl

  • From: Miika Komu <mkomu@xxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Sun, 26 Feb 2012 14:09:39 +0200

Hi,

On 02/26/2012 01:50 PM, Christof Mroz wrote:
+{
+    struct hip_ll_node *curr;
+    struct hip_ll_node *tmp;
+
+    /* match first list node */
+    if (linkedlist != NULL&&  linkedlist->element_count>  0

the check for linkedlist != NULL should also cover the second part of
this
function. I'd suggest adding an assertion for it.

Passing NULL to free()-like functions is usually a no-op (by
convention), so I disagree.

don't know if this applies here but, in general, we have agreed that calling free(NULL) in the context of e.g. HIP_IFEL() is fine as indicated by doc/HACKING:

  int f(void)
  {
      char *mem = NULL;
      HIP_IFEL(!(mem = HIP_ALLOC(256, 0)), -1, "alloc\n");

  out_err:
      free(mem);
      return err;
  }

This keeps the line count at minimum.

Other related posts: