From 17133a85de3326ec7c63f800581984392ddd276f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 19 Jan 2011 09:41:54 +0000 Subject: [PATCH] * exec.cc (strccpy): Move function from here... * strfuncs.cc (strccpy): ...to here. * string.h (strccpy): Declare. * winsup.h (strccpy): Drop declaration. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/exec.cc | 15 --------------- winsup/cygwin/strfuncs.cc | 16 +++++++++++++++- winsup/cygwin/string.h | 4 +++- winsup/cygwin/winsup.h | 3 --- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index aa6af3076..0461fdf85 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2011-01-19 Corinna Vinschen + + * exec.cc (strccpy): Move function from here... + * strfuncs.cc (strccpy): ...to here. + * string.h (strccpy): Declare. + * winsup.h (strccpy): Drop declaration. + 2011-01-19 Corinna Vinschen * errno.cc (errmap): Add error codes for invalid binaries. diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc index d4462b534..327e86a09 100644 --- a/winsup/cygwin/exec.cc +++ b/winsup/cygwin/exec.cc @@ -68,21 +68,6 @@ sexecve_is_bad () return 0; } -/* Copy string, until c or is encountered. - NUL-terminate the destination string (s1). - Return pointer to terminating byte in dst string. */ - -char * __stdcall -strccpy (char *s1, const char **s2, char c) -{ - while (**s2 && **s2 != c) - *s1++ = *((*s2)++); - *s1 = 0; - - MALLOC_CHECK; - return s1; -} - extern "C" int execvp (const char *path, char * const *argv) { diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index 097421703..8b13b20d8 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -1,7 +1,7 @@ /* strfuncs.cc: misc funcs that don't belong anywhere else Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. This file is part of Cygwin. @@ -663,6 +663,20 @@ sys_mbstowcs_alloc (wchar_t **dst_p, int type, const char *src, size_t nms) return ret; } +/* Copy string, until c or is encountered. + NUL-terminate the destination string (s1). + Return pointer to terminating byte in dst string. */ +char * __stdcall +strccpy (char *s1, const char **s2, char c) +{ + while (**s2 && **s2 != c) + *s1++ = *((*s2)++); + *s1 = 0; + + MALLOC_CHECK; + return s1; +} + static WCHAR hex_wchars[] = L"0123456789abcdef"; NTSTATUS NTAPI diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h index b02fadb8f..318256032 100644 --- a/winsup/cygwin/string.h +++ b/winsup/cygwin/string.h @@ -1,6 +1,6 @@ /* string.h: Extra string defs - Copyright 2001, 2007, 2008 Red Hat, Inc. + Copyright 2001, 2007, 2008, 2011 Red Hat, Inc. This file is part of Cygwin. @@ -119,6 +119,8 @@ char * __stdcall cygwin_strupr (char *); #endif /* __INSIDE_CYGWIN__ */ +char *__stdcall strccpy (char *s1, const char **s2, char c); + #ifdef __cplusplus } #endif diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 3ffd3b703..5d07afdb4 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -211,9 +211,6 @@ __ino64_t __stdcall hash_path_name (__ino64_t hash, PCWSTR name) __attribute__ ( __ino64_t __stdcall hash_path_name (__ino64_t hash, const char *name) __attribute__ ((regparm(2))); void __stdcall nofinalslash (const char *src, char *dst) __attribute__ ((regparm(2))); -/* String manipulation */ -extern "C" char *__stdcall strccpy (char *s1, const char **s2, char c); - void *hook_or_detect_cygwin (const char *, const void *, WORD&) __attribute__ ((regparm (3))); /* Time related */