=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdist/common.c,v retrieving revision 1.26 retrieving revision 1.27 diff -c -r1.26 -r1.27 *** src/usr.bin/rdist/common.c 2011/04/24 02:23:57 1.26 --- src/usr.bin/rdist/common.c 2014/07/05 05:05:51 1.27 *************** *** 1,4 **** ! /* $OpenBSD: common.c,v 1.26 2011/04/24 02:23:57 deraadt Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: common.c,v 1.27 2014/07/05 05:05:51 guenther Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. *************** *** 831,874 **** /* * Malloc with error checking */ ! char * xmalloc(size_t amt) { ! char *ptr; ! if ((ptr = (char *)malloc(amt)) == NULL) fatalerr("Cannot malloc %zu bytes of memory.", amt); ! return(ptr); } /* * realloc with error checking */ ! char * ! xrealloc(char *baseptr, size_t amt) { ! char *new; ! if ((new = (char *)realloc(baseptr, amt)) == NULL) fatalerr("Cannot realloc %zu bytes of memory.", amt); ! return(new); } /* * calloc with error checking */ ! char * xcalloc(size_t num, size_t esize) { ! char *ptr; ! if ((ptr = (char *)calloc(num, esize)) == NULL) fatalerr("Cannot calloc %zu * %zu = %zu bytes of memory.", num, esize, num * esize); ! return(ptr); } /* --- 831,874 ---- /* * Malloc with error checking */ ! void * xmalloc(size_t amt) { ! void *ptr; ! if ((ptr = malloc(amt)) == NULL) fatalerr("Cannot malloc %zu bytes of memory.", amt); ! return (ptr); } /* * realloc with error checking */ ! void * ! xrealloc(void *baseptr, size_t amt) { ! void *new; ! if ((new = realloc(baseptr, amt)) == NULL) fatalerr("Cannot realloc %zu bytes of memory.", amt); ! return (new); } /* * calloc with error checking */ ! void * xcalloc(size_t num, size_t esize) { ! void *ptr; ! if ((ptr = calloc(num, esize)) == NULL) fatalerr("Cannot calloc %zu * %zu = %zu bytes of memory.", num, esize, num * esize); ! return (ptr); } /* *************** *** 878,889 **** xstrdup(const char *str) { size_t len = strlen(str) + 1; ! char *nstr = (char *) malloc(len); ! if (nstr == NULL) ! fatalerr("Cannot malloc %zu bytes of memory.", len); ! ! return(memcpy(nstr, str, len)); } /* --- 878,886 ---- xstrdup(const char *str) { size_t len = strlen(str) + 1; ! char *nstr = xmalloc(len); ! return (memcpy(nstr, str, len)); } /*