unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Using strcasecmp in xterm.c
@ 2006-12-07  9:09 Kim F. Storm
  2006-12-07 11:16 ` Kenichi Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2006-12-07  9:09 UTC (permalink / raw)



In xterm.c, we use strcasecmp here:

struct font_info *
x_query_font (f, fontname)
     struct frame *f;
     register char *fontname;
{
  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
  int i;

  for (i = 0; i < dpyinfo->n_fonts; i++)
    if (dpyinfo->font_table[i].name
	&& (!strcasecmp (dpyinfo->font_table[i].name, fontname)
	    || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
      return (dpyinfo->font_table + i);
  return NULL;
}


Shouldn't this use xstricmp which is specifically defined to compare
fontnames according to the comment in xfaces.c ?


/* Like stricmp.  Used to compare parts of font names which are in
   ISO8859-1.  */

int
xstricmp (s1, s2)

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using strcasecmp in xterm.c
  2006-12-07  9:09 Using strcasecmp in xterm.c Kim F. Storm
@ 2006-12-07 11:16 ` Kenichi Handa
  2006-12-07 13:06   ` Kim F. Storm
  2006-12-07 21:41   ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Kenichi Handa @ 2006-12-07 11:16 UTC (permalink / raw)
  Cc: emacs-devel

In article <m3odqgf4y2.fsf@kfs-l.imdomain.dk>, storm@cua.dk (Kim F. Storm) writes:

> In xterm.c, we use strcasecmp here:

> struct font_info *
> x_query_font (f, fontname)
>      struct frame *f;
>      register char *fontname;
> {
>   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
>   int i;

>   for (i = 0; i < dpyinfo->n_fonts; i++)
>     if (dpyinfo->font_table[i].name
> 	&& (!strcasecmp (dpyinfo->font_table[i].name, fontname)
> 	    || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
>       return (dpyinfo->font_table + i);
>   return NULL;
> }


> Shouldn't this use xstricmp which is specifically defined to compare
> fontnames according to the comment in xfaces.c ?

What is the difference between xstricmp and strcasecmp?

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using strcasecmp in xterm.c
  2006-12-07 11:16 ` Kenichi Handa
@ 2006-12-07 13:06   ` Kim F. Storm
  2006-12-08  1:02     ` Kenichi Handa
  2006-12-07 21:41   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2006-12-07 13:06 UTC (permalink / raw)
  Cc: emacs-devel

Kenichi Handa <handa@m17n.org> writes:

> In article <m3odqgf4y2.fsf@kfs-l.imdomain.dk>, storm@cua.dk (Kim F. Storm) writes:
>
>> In xterm.c, we use strcasecmp here:
>
>> struct font_info *
>> x_query_font (f, fontname)
>>      struct frame *f;
>>      register char *fontname;
>> {
>>   struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
>>   int i;
>
>>   for (i = 0; i < dpyinfo->n_fonts; i++)
>>     if (dpyinfo->font_table[i].name
>> 	&& (!strcasecmp (dpyinfo->font_table[i].name, fontname)
>> 	    || !strcasecmp (dpyinfo->font_table[i].full_name, fontname)))
>>       return (dpyinfo->font_table + i);
>>   return NULL;
>> }
>
>
>> Shouldn't this use xstricmp which is specifically defined to compare
>> fontnames according to the comment in xfaces.c ?
>
> What is the difference between xstricmp and strcasecmp?

I dunno -- but strcasecmp doesn't exist on all systems (I just learned
that), and xstricmp comes with Emacs, so it seems safer to use it.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using strcasecmp in xterm.c
  2006-12-07 11:16 ` Kenichi Handa
  2006-12-07 13:06   ` Kim F. Storm
@ 2006-12-07 21:41   ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2006-12-07 21:41 UTC (permalink / raw)
  Cc: emacs-devel, storm

> From: Kenichi Handa <handa@m17n.org>
> Date: Thu, 07 Dec 2006 20:16:41 +0900
> Cc: emacs-devel@gnu.org
> 
> What is the difference between xstricmp and strcasecmp?

They are identical in the C locale.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using strcasecmp in xterm.c
  2006-12-07 13:06   ` Kim F. Storm
@ 2006-12-08  1:02     ` Kenichi Handa
  0 siblings, 0 replies; 5+ messages in thread
From: Kenichi Handa @ 2006-12-08  1:02 UTC (permalink / raw)
  Cc: emacs-devel

In article <m364cng8i7.fsf@kfs-l.imdomain.dk>, storm@cua.dk (Kim F. Storm) writes:

>>> Shouldn't this use xstricmp which is specifically defined to compare
>>> fontnames according to the comment in xfaces.c ?
> >
> > What is the difference between xstricmp and strcasecmp?

> I dunno -- but strcasecmp doesn't exist on all systems (I just learned
> that), and xstricmp comes with Emacs, so it seems safer to use it.

Ah, I see.  I've just installed that change.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-12-08  1:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07  9:09 Using strcasecmp in xterm.c Kim F. Storm
2006-12-07 11:16 ` Kenichi Handa
2006-12-07 13:06   ` Kim F. Storm
2006-12-08  1:02     ` Kenichi Handa
2006-12-07 21:41   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).