[BACK]Return to xmalloc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/xmalloc.c between version 1.9 and 1.10

version 1.9, 2015/11/18 13:06:54 version 1.10, 2016/04/04 16:19:43
Line 5 
Line 5 
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland   * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved   *                    All rights reserved
  * Versions of malloc and friends that check their results, and never return   * Versions of malloc and friends that check their results, and never return
  * failure (they call fatal if they encounter an error).   * failure (they call fatalx if they encounter an error).
  *   *
  * As far as I am concerned, the code I have written for this software   * As far as I am concerned, the code I have written for this software
  * can be used freely for any purpose.  Any derived versions of this   * can be used freely for any purpose.  Any derived versions of this
Line 29 
Line 29 
         void *ptr;          void *ptr;
   
         if (size == 0)          if (size == 0)
                 fatal("xmalloc: zero size");                  fatalx("xmalloc: zero size");
         ptr = malloc(size);          ptr = malloc(size);
         if (ptr == NULL)          if (ptr == NULL)
                 fatal("xmalloc: allocating %zu bytes: %s",                  fatalx("xmalloc: allocating %zu bytes: %s",
                     size, strerror(errno));                      size, strerror(errno));
         return ptr;          return ptr;
 }  }
Line 43 
Line 43 
         void *ptr;          void *ptr;
   
         if (size == 0 || nmemb == 0)          if (size == 0 || nmemb == 0)
                 fatal("xcalloc: zero size");                  fatalx("xcalloc: zero size");
         ptr = calloc(nmemb, size);          ptr = calloc(nmemb, size);
         if (ptr == NULL)          if (ptr == NULL)
                 fatal("xcalloc: allocating %zu * %zu bytes: %s",                  fatalx("xcalloc: allocating %zu * %zu bytes: %s",
                     nmemb, size, strerror(errno));                      nmemb, size, strerror(errno));
         return ptr;          return ptr;
 }  }
Line 63 
Line 63 
         void *new_ptr;          void *new_ptr;
   
         if (nmemb == 0 || size == 0)          if (nmemb == 0 || size == 0)
                 fatal("xreallocarray: zero size");                  fatalx("xreallocarray: zero size");
         new_ptr = reallocarray(ptr, nmemb, size);          new_ptr = reallocarray(ptr, nmemb, size);
         if (new_ptr == NULL)          if (new_ptr == NULL)
                 fatal("xreallocarray: allocating %zu * %zu bytes: %s",                  fatalx("xreallocarray: allocating %zu * %zu bytes: %s",
                     nmemb, size, strerror(errno));                      nmemb, size, strerror(errno));
         return new_ptr;          return new_ptr;
 }  }
Line 77 
Line 77 
         char *cp;          char *cp;
   
         if ((cp = strdup(str)) == NULL)          if ((cp = strdup(str)) == NULL)
                 fatal("xstrdup: %s", strerror(errno));                  fatalx("xstrdup: %s", strerror(errno));
         return cp;          return cp;
 }  }
   
Line 102 
Line 102 
         i = vasprintf(ret, fmt, ap);          i = vasprintf(ret, fmt, ap);
   
         if (i < 0 || *ret == NULL)          if (i < 0 || *ret == NULL)
                 fatal("xasprintf: %s", strerror(errno));                  fatalx("xasprintf: %s", strerror(errno));
   
         return i;          return i;
 }  }
Line 126 
Line 126 
         int i;          int i;
   
         if (len > INT_MAX)          if (len > INT_MAX)
                 fatal("xsnprintf: len > INT_MAX");                  fatalx("xsnprintf: len > INT_MAX");
   
         i = vsnprintf(str, len, fmt, ap);          i = vsnprintf(str, len, fmt, ap);
   
         if (i < 0 || i >= (int)len)          if (i < 0 || i >= (int)len)
                 fatal("xsnprintf: overflow");                  fatalx("xsnprintf: overflow");
   
         return i;          return i;
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10