diff options
| author | 2009-06-15 18:08:07 -0700 | |
|---|---|---|
| committer | 2009-06-15 18:08:07 -0700 | |
| commit | 7eef4091a653c243a87e5375c54504cc03bec4d8 (patch) | |
| tree | f65b77f830b2c8f7d014512badfef5df0d591ee9 /include/linux/nls.h | |
| parent | NFSv4: kill off complicated macro 'PROC' (diff) | |
| parent | Linux 2.6.30 (diff) | |
| download | linux-dev-7eef4091a653c243a87e5375c54504cc03bec4d8.tar.xz linux-dev-7eef4091a653c243a87e5375c54504cc03bec4d8.zip | |
Merge commit 'v2.6.30' into for-2.6.31
Diffstat (limited to 'include/linux/nls.h')
| -rw-r--r-- | include/linux/nls.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/nls.h b/include/linux/nls.h index 6a882208301a..52b1a76c1b43 100644 --- a/include/linux/nls.h +++ b/include/linux/nls.h @@ -58,6 +58,25 @@ static inline int nls_strnicmp(struct nls_table *t, const unsigned char *s1, return 0; } +/* + * nls_nullsize - return length of null character for codepage + * @codepage - codepage for which to return length of NULL terminator + * + * Since we can't guarantee that the null terminator will be a particular + * length, we have to check against the codepage. If there's a problem + * determining it, assume a single-byte NULL terminator. + */ +static inline int +nls_nullsize(const struct nls_table *codepage) +{ + int charlen; + char tmp[NLS_MAX_CHARSET_SIZE]; + + charlen = codepage->uni2char(0, tmp, NLS_MAX_CHARSET_SIZE); + + return charlen > 0 ? charlen : 1; +} + #define MODULE_ALIAS_NLS(name) MODULE_ALIAS("nls_" __stringify(name)) #endif /* _LINUX_NLS_H */ |
