This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


+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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]