* nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script):
Avoid redundant calls to strlen.
This commit is contained in:
parent
edfa7fa092
commit
fd3ceb0999
2 changed files with 12 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
16
src/nsfont.m
16
src/nsfont.m
|
@ -75,10 +75,9 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
|
|||
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 = '_';
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,10 +85,9 @@ static void ns_glyph_metrics (struct nsfont_info *font_info,
|
|||
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 = ' ';
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,7 +362,7 @@ seems to be limited for now (2009/05) to ja, zh, and ko. */
|
|||
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))];
|
||||
|
|
Loading…
Add table
Reference in a new issue