X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/locale/FreeBSD/mbrlen.c diff --git a/locale/FreeBSD/mbrlen.c b/locale/FreeBSD/mbrlen.c index 0d49fe5..2f0227a 100644 --- a/locale/FreeBSD/mbrlen.c +++ b/locale/FreeBSD/mbrlen.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002 Tim J. Robbins. + * Copyright (c) 2002-2004 Tim J. Robbins. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,13 +25,25 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.2 2002/09/06 11:23:45 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); + +#include "xlocale_private.h" #include +#include "mblocal.h" size_t -mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps __unused) +mbrlen_l(const char * __restrict s, size_t n, mbstate_t * __restrict ps, + locale_t loc) { + NORMALIZE_LOCALE(loc); + if (ps == NULL) + ps = &loc->__mbs_mbrlen; + return (loc->__lc_ctype->__mbrtowc(NULL, s, n, ps, loc)); +} - return (mbrtowc(NULL, s, n, NULL)); +size_t +mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) +{ + return mbrlen_l(s, n, ps, __current_locale()); }