From 17f3e3dcb47c4b1f83f6737e61a4a3d47a067038 Mon Sep 17 00:00:00 2001 From: jthorn Date: Fri, 2 May 2003 18:57:57 +0000 Subject: Change from using a private Strlcpy() function to the Util_Strlcpy() one that's now in the Cactus flesh. ***** ***** After this change, you will need to cvs-update your copy of the ***** Cactus flesh (files src/util/String.c and src/util/util_String.h) ***** in order to recompile this thorn. ***** git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalInterp/trunk@149 df1f8a13-aa1d-4dd4-9681-27ded5b42416 --- src/GeneralizedPolynomial-Uniform/util.c | 63 +------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) (limited to 'src/GeneralizedPolynomial-Uniform/util.c') diff --git a/src/GeneralizedPolynomial-Uniform/util.c b/src/GeneralizedPolynomial-Uniform/util.c index 03186f0..d17f29b 100644 --- a/src/GeneralizedPolynomial-Uniform/util.c +++ b/src/GeneralizedPolynomial-Uniform/util.c @@ -16,13 +16,8 @@ #include #include -#ifdef LOCALINTERP_STANDALONE_BUILD - #define WANT_STRLCPY -#else +#ifndef LOCALINTERP_STANDALONE_BUILD #include "cctk.h" - #define WANT_ZERO_INT_ARRAY - #define WANT_DECODE_N_PARTS - #define WANT_STRLCPY #endif #include "InterpLocalUniform.h" @@ -35,7 +30,6 @@ static const char *rcsid = "$Header$"; /******************************************************************************/ -#ifdef WANT_DECODE_N_PARTS /*@@ @routine LocalInterp_decode_N_parts @date 22 Jan 2002 @@ -84,58 +78,3 @@ case CCTK_VARIABLE_FPOINTER: return 0; default: return -1; } } -#endif /* WANT_DECODE_N_PARTS */ - -/******************************************************************************/ - -#ifdef WANT_STRLCPY -/*@@ - @routine LocalInterp_Strlcpy - @date 1.Feb.2003 - @author Jonathan Thornburg - @desc This function implements the strlcpy() function - described in - http://www.openbsd.org/papers/strlcpy-paper.ps - - The strlcpy(3) function copies up to size-1 characters - from the null-terminated string src to dst , followed - by a null character (so dst is always null-terminated). - - strlcpy(3) is a replacement for strncpy(3). In comparison - to strncpy(3), strlcpy(3) is safer and easier to use (it - guarantees null termination of the destination buffer), - and faster (it doesn't have to fill the entire buffer with - null characters). - @enddesc - - @var dst - @vdesc A non-null pointer to the destination buffer. - @vtype char* dst - @endvar - - @var src - @vdesc A non-null pointer to the source string. - @vtype const char* dst - @endvar - - @var dst_size - @vdesc The size of the destination buffer. - @vtype size_t dst_size - @endvar - - @returntype size_t - @returndesc This function returns strlen(src). - @endreturndesc - @@*/ -size_t LocalInterp_Strlcpy(char* dst, const char* src, size_t dst_size) -{ -const size_t src_size = strlen(src); -if (src_size < dst_size) - then strcpy(dst, src); - else { - strncpy(dst, src, dst_size-1); - dst[dst_size-1] = '\0'; - } -return src_size; -} -#endif /* WANT_STRLCPY */ -- cgit v1.2.3