From 6523d94ee3e7441378e5a7e28edb96d99f812a34 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Wed, 9 Apr 2014 19:31:51 +0000 Subject: We need hts_stringMemCopy() --- src/htscharset.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/htscharset.c b/src/htscharset.c index 272ec14..5496492 100644 --- a/src/htscharset.c +++ b/src/htscharset.c @@ -71,6 +71,18 @@ static int hts_equalsAlphanum(const char *a, const char *b) { #undef IS_ALNUM #undef CHAR_LOWER +/* Copy the memory region [s .. s + size - 1 ] as a \0-terminated string. */ +static char *hts_stringMemCopy(const char *s, size_t size) { + char *dest = malloc(size + 1); + + if (dest != NULL) { + memcpy(dest, s, size); + dest[size] = '\0'; + return dest; + } + return NULL; +} + #ifdef _WIN32 typedef struct wincodepage_t wincodepage_t; @@ -240,18 +252,6 @@ UINT hts_getCodepage(const char *name) { return 0; } -/* Copy the memory region [s .. s + size - 1 ] as a \0-terminated string. */ -static char *hts_stringMemCopy(const char *s, size_t size) { - char *dest = malloc(size + 1); - - if (dest != NULL) { - memcpy(dest, s, size); - dest[size] = '\0'; - return dest; - } - return NULL; -} - LPWSTR hts_convertStringToUCS2(const char *s, int size, UINT cp, int *pwsize) { /* Size in wide chars of the output */ const int wsize = MultiByteToWideChar(cp, 0, (LPCSTR) s, size, NULL, 0); -- cgit v1.2.3