all: Don't use ctype.h macros

The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
This commit is contained in:
Dan Winship
2012-09-25 10:44:23 -04:00
parent 74b6b9c768
commit 6878d20ac4
26 changed files with 34 additions and 60 deletions

View File

@@ -22,7 +22,6 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <string.h>
#include <ctype.h>
#include "nm-dhcp-dhclient-utils.h"
@@ -108,7 +107,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
break;
}
if (!isalnum ((*aiter)[0]))
if (!g_ascii_isalnum ((*aiter)[0]))
continue;
if ((*aiter)[strlen (*aiter) - 1] == ';') {
@@ -147,7 +146,7 @@ nm_dhcp_dhclient_create_config (const char *interface,
const char *p = tmp;
while (*p) {
if (!isxdigit (*p) && (*p != ':')) {
if (!g_ascii_isxdigit (*p) && (*p != ':')) {
is_octets = FALSE;
break;
}