From 8b60cc8039bb6ffaf924f314e0c8c0cd24cd0880 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 13 Feb 2019 10:21:39 -0800 Subject: [PATCH] opal/util: remove opal_strncpy() This function is not used anywhere anymore. Signed-off-by: Jeff Squyres --- opal/util/Makefile.am | 2 -- opal/util/strncpy.c | 63 ------------------------------------------- opal/util/strncpy.h | 42 ----------------------------- 3 files changed, 107 deletions(-) delete mode 100644 opal/util/strncpy.c delete mode 100644 opal/util/strncpy.h diff --git a/opal/util/Makefile.am b/opal/util/Makefile.am index 078cba205f..521acc8bf9 100644 --- a/opal/util/Makefile.am +++ b/opal/util/Makefile.am @@ -70,7 +70,6 @@ headers = \ show_help.h \ show_help_lex.h \ stacktrace.h \ - strncpy.h \ string_copy.h \ sys_limits.h \ timings.h \ @@ -110,7 +109,6 @@ libopalutil_la_SOURCES = \ show_help.c \ show_help_lex.l \ stacktrace.c \ - strncpy.c \ string_copy.c \ sys_limits.c \ uri.c \ diff --git a/opal/util/strncpy.c b/opal/util/strncpy.c deleted file mode 100644 index 4781536200..0000000000 --- a/opal/util/strncpy.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * This file is only here because some platforms have a broken strncpy - * (e.g., Itanium with RedHat Advanced Server glibc). - */ - -#include "opal_config.h" - -#include - -#include "opal/util/strncpy.h" - - -/** - * Provide a portable, working strncpy() for platforms that have - * broken implementations. - * - * @param dest Destination string. - * @param src Source string. - * @param len Length of the string to copy. - * - * @return The value dest. - * - * This function is identical in behavior to strncpy(), but is not - * optimized at all (we're not concerned with high-performance - * strncpy!). It is only here because some platforms have broken - * implementations of strncpy() that cause segfaults (cough cough Red - * Hat Advanced Server glibc cough cough). - */ -char * -opal_strncpy(char *dest, const char *src, size_t len) -{ - size_t i; - int pad = 0; - char *new_dest = dest; - - for (i = 0; i < len; ++i, ++src, ++new_dest) { - if (pad != 0) - *new_dest = '\0'; - else { - *new_dest = *src; - if ('\0' == *src) - pad = 1; - } - } - - return dest; -} diff --git a/opal/util/strncpy.h b/opal/util/strncpy.h deleted file mode 100644 index 8a217560ba..0000000000 --- a/opal/util/strncpy.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef OPAL_STRNCPY_H -#define OPAL_STRNCPY_H - -#include "opal_config.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -/* - * Use opal_strncpy() instead of strncpy() - */ -#if defined(strncpy) -#undef strncpy -#endif -#define strncpy opal_strncpy - -BEGIN_C_DECLS - -/* Might also be pure? */ -OPAL_DECLSPEC char *opal_strncpy(char *dest, const char *src, size_t len) __opal_attribute_nonnull__(1) __opal_attribute_nonnull__(2); - -END_C_DECLS - -#endif /* OPAL_STRNCPY_H */