Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ypcmd/revnetgroup/util.h
          +++ new/usr/src/cmd/ypcmd/revnetgroup/util.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  #ifndef __UTIL_H
  27   28  #define __UTIL_H
  28   29  
  29   30  #ifdef  __cplusplus
  30   31  extern "C" {
  31   32  #endif
  32   33  
  33      -#define EOS '\0'
       34 +#define EOS '\0'
  34   35  
  35      -#ifndef NULL 
  36      -#       define NULL ((char *) 0)
  37      -#endif
       36 +#define MALLOC(object_type) ((object_type *)malloc(sizeof (object_type)))
  38   37  
       38 +#define FREE(ptr)       free((char *)ptr)
  39   39  
  40      -#define MALLOC(object_type) ((object_type *) malloc(sizeof(object_type)))
       40 +#define STRCPY(dst, src) \
       41 +        (dst = malloc((unsigned)strlen(src)+1), (void)strcpy(dst, src))
  41   42  
  42      -#define FREE(ptr)       free((char *) ptr) 
       43 +#define STRNCPY(dst, src, num) \
       44 +        (dst = (char *)malloc((unsigned)(num) + 1),\
       45 +        (void) strncpy(dst, src, num), (dst)[num] = EOS)
  43   46  
  44      -#define STRCPY(dst,src) \
  45      -        (dst = malloc((unsigned)strlen(src)+1), (void) strcpy(dst,src))
  46      -
  47      -#define STRNCPY(dst,src,num) \
  48      -        (dst = (char *) malloc((unsigned)(num) + 1),\
  49      -        (void)strncpy(dst,src,num),(dst)[num] = EOS) 
  50      -
  51      -/*
  52      -extern char *malloc();
  53      -*/
  54      -extern char *alloca();
  55      -
  56   47  char *getaline();
  57      -void fatal();
  58   48  
  59   49  #ifdef  __cplusplus
  60   50  }
  61   51  #endif
  62   52  
  63   53  #endif  /* __UTIL_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX