Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Aug 2012 21:00:34 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r239534 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common
Message-ID:  <201208212100.q7LL0YsY005010@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Aug 21 21:00:33 2012
New Revision: 239534
URL: http://svn.freebsd.org/changeset/base/239534

Log:
  MFC	r238509:
  
  Use libc's strndup() instead of Dtrace's reimplementation.
  
  Corresponds partially to OpenSolaris change:
  PSARC 2010/299 GNU/Linux/BSD compatibility functions
  6901783 strndup would be nice.

Modified:
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c
  stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c	Tue Aug 21 20:40:12 2012	(r239533)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.c	Tue Aug 21 21:00:33 2012	(r239534)
@@ -29,23 +29,6 @@
 #include <ctype.h>
 
 #include <dt_string.h>
-#include <dt_impl.h>
-
-/*
- * Create a copy of string s, but only duplicate the first n bytes.
- */
-char *
-strndup(const char *s, size_t n)
-{
-	char *s2 = malloc(n + 1);
-
-	if (s2 == NULL)
-		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
-
-	(void) strncpy(s2, s, n);
-	s2[n] = '\0';
-	return (s2);
-}
 
 /*
  * Transform string s inline, converting each embedded C escape sequence string

Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h
==============================================================================
--- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h	Tue Aug 21 20:40:12 2012	(r239533)
+++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_string.h	Tue Aug 21 21:00:33 2012	(r239534)
@@ -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,14 +19,12 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #ifndef	_DT_STRING_H
 #define	_DT_STRING_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sys/types.h>
 #include <strings.h>
@@ -36,7 +33,6 @@
 extern "C" {
 #endif
 
-extern char *strndup(const char *, size_t);
 extern size_t stresc2chr(char *);
 extern char *strchr2esc(const char *, size_t);
 extern const char *strbasename(const char *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208212100.q7LL0YsY005010>