diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-04-09 19:31:51 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-04-09 19:31:51 +0000 |
commit | 6523d94ee3e7441378e5a7e28edb96d99f812a34 (patch) | |
tree | c15603b0933a4b30c54ce4362516243b1d0db26e /src/htscharset.c | |
parent | 1e6399e37bb10d162990758d08f677ed4b2995dc (diff) |
We need hts_stringMemCopy()
Diffstat (limited to 'src/htscharset.c')
-rw-r--r-- | src/htscharset.c | 24 |
1 files changed, 12 insertions, 12 deletions
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); |