comparison lwlib/lwlib-fonts.c @ 5335:c9d31263ab7d

Replace POSIX index(3) with C89 strchr(3), lwlib-fonts.c 2011-01-11 Aidan Kehoe <kehoea@parhasard.net> * lwlib-fonts.c (xft_open_font_by_name): Replace the POSIX index(3), not universally available even today, with the C89 strchr(3), hopefully fixing a few of the buildbots' problems.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 11 Jan 2011 13:39:35 +0000
parents a6c778975d7d
children 7ebbe334061e
comparison
equal deleted inserted replaced
5334:b249c479f9e1 5335:c9d31263ab7d
74 /* if (!NILP (Fxft_xlfd_font_name_p (make_string (name, strlen (name))))) */ 74 /* if (!NILP (Fxft_xlfd_font_name_p (make_string (name, strlen (name))))) */
75 /* #### this is bogus but ... */ 75 /* #### this is bogus but ... */
76 int count = 0; 76 int count = 0;
77 char *pos = name; 77 char *pos = name;
78 /* extra parens shut up gcc */ 78 /* extra parens shut up gcc */
79 while ((pos = index (pos, '-'))) 79 while ((pos = strchr (pos, '-')))
80 { 80 {
81 count++; 81 count++;
82 pos++; 82 pos++;
83 } 83 }
84 84
85 /* #### hard-coding DefaultScreen is evil! */ 85 /* #### hard-coding DefaultScreen is evil! */
86 if (count == 14 /* fully-qualified XLFD */ 86 if (count == 14 /* fully-qualified XLFD */
87 || (count < 14 /* heuristic for wildcarded XLFD */ 87 || (count < 14 /* heuristic for wildcarded XLFD */
88 && count >= 5 88 && count >= 5
89 && index (name, '*'))) 89 && strchr (name, '*')))
90 res = XftFontOpenXlfd (dpy, DefaultScreen (dpy), name); 90 res = XftFontOpenXlfd (dpy, DefaultScreen (dpy), name);
91 else 91 else
92 res = XftFontOpenName (dpy, DefaultScreen (dpy), name); 92 res = XftFontOpenName (dpy, DefaultScreen (dpy), name);
93 93
94 /* Try for a generic monospace font 94 /* Try for a generic monospace font