diff options
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c b/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c index 7cdbf01..05d8622 100644 --- a/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c +++ b/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c @@ -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. @@ -20,12 +19,10 @@ * 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. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #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; |