Rebase to OpenSolaris b103, in the process we are removing any code which did not...
[zfs.git] / zfs / lib / libuutil / uu_alloc.c
index 53f3496..05d8622 100644 (file)
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-
-
 #include "libuutil_common.h"
 
 #include <stdarg.h>
@@ -55,6 +52,22 @@ uu_free(void *p)
 }
 
 char *
+uu_strdup(const char *str)
+{
+       char *buf = NULL;
+
+       if (str != NULL) {
+               size_t sz;
+
+               sz = strlen(str) + 1;
+               buf = uu_zalloc(sz);
+               if (buf != NULL)
+                       (void) memcpy(buf, str, sz);
+       }
+       return (buf);
+}
+
+char *
 uu_msprintf(const char *format, ...)
 {
        va_list args;