]> git.saurik.com Git - apple/network_cmds.git/blobdiff - rtadvd.tproj/rtadvd.h
network_cmds-543.270.1.tar.gz
[apple/network_cmds.git] / rtadvd.tproj / rtadvd.h
index d019b1945955a5ce84c23c658a0f43e072c823e5..7e4ca7663a56aa18b83f76855c2653212afafee4 100644 (file)
@@ -2,6 +2,7 @@
 
 /*
  * Copyright (C) 1998 WIDE Project.
+ * Copyright (C) 2011 Hiroki Sato <hrs@FreeBSD.org>
  * All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "rtadvd_logging.h"
+
+#define        ELM_MALLOC(p, error_action)                                     \
+       do {                                                            \
+               p = malloc(sizeof(*p));                                 \
+               if (p == NULL) {                                        \
+                       errorlog("<%s> malloc failed: %s",      \
+                           __func__, strerror(errno));                 \
+                       error_action;                                   \
+               }                                                       \
+               memset(p, 0, sizeof(*p));                               \
+       } while(0)
 
 #define        ROUTEINFO       1