Avoid redundant calls to strlen.
+2013-01-24 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script):
+ Avoid redundant calls to strlen.
+
2013-01-24 Dmitry Antipov <dmantipov@yandex.ru>
Drop async_visible and async_iconified fields of struct frame.
static void
ns_escape_name (char *name)
{
- int i =0, len =strlen (name);
- for ( ; i<len; i++)
- if (name[i] == ' ')
- name[i] = '_';
+ for (; *name; name++)
+ if (*name == ' ')
+ *name = '_';
}
static void
ns_unescape_name (char *name)
{
- int i =0, len =strlen (name);
- for ( ; i<len; i++)
- if (name[i] == '_')
- name[i] = ' ';
+ for (; *name; name++)
+ if (*name == '_')
+ *name = ' ';
}
while CONSP (rts)
{
r = XCAR (XCAR (rts));
- if (!strncmp(SSDATA(r), reg, strlen(SSDATA(r))))
+ if (!strncmp (SSDATA (r), reg, SBYTES (r)))
{
script = XCDR (XCAR (rts));
return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (script))];