diff options
Diffstat (limited to 'src/string.c')
-rw-r--r-- | src/string.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/string.c b/src/string.c deleted file mode 100644 index 9a5158eb..00000000 --- a/src/string.c +++ /dev/null @@ -1,47 +0,0 @@ -/* string.c - String functions - Copyright (C) 2003, Free Software Foundation, Inc. - - This file is part of Libgcrypt. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. */ - -#include <stdlib.h> - -#include <config.h> -#include "g10lib.h" - -/* Create and return a copy of the null-terminated string STRING. If - it is contained in secure memory, the copy will be contained in - secure memory as well. In an out-of-memory condition, NULL is - returned. */ -char * -gcry_strdup (const char *string) -{ - char *string_cp = NULL; - size_t string_n = 0; - - string_n = strlen (string); - - if (gcry_is_secure (string)) - string_cp = gcry_malloc_secure (string_n + 1); - else - string_cp = gcry_malloc (string_n + 1); - - if (string_cp) - memcpy (string_cp, string, string_n + 1); - - return string_cp; -} |