[PATCH/RFA] Revamp wctomb/mbtowc conversion, add more charset support

Howland Craig D (Craig) howland@LGSInnovations.com
Sat Mar 21 10:22:00 GMT 2009


+int
+__cp_index (const char *charset_ext)
+{
+  int cp_idx = atoi (__locale_charset () + 2);
+  switch (cp_idx)
+    { 
...

The charset_ext argument appears to be unused.  In the two places in
which __cp_index() is actually called, both use
"int cp_idx = __cp_index (__locale_charset () + 2);" , so I think that
probably:
 int
 __cp_index (const char *charset_ext)
 {
-  int cp_idx = atoi (__locale_charset () + 2);
+  int cp_idx = atoi (charset_ext);
   switch (cp_idx)
     { 
is in order.
 
I've only taken a cursory glance, but I'm also wondering about the
"(__locale_charset () + 2)" bit.  It appears as if that is a
leftover from the "Old newlib style" mentioned in locale.c, where a
"C-" used to be at the beginning of the lc_message_charset values.
I think that s/__locale_charset () + 2/__locale_charset ()/ ought to
be done, which is the two aforementioned calls to __cp_index().
 
Of lesser importance, the ChangeLog entry fails to mention __cp_index
as a new function.
 
Craig



More information about the Newlib mailing list