]> code.delx.au - gnu-emacs/commitdiff
Prefer xlispstrdup to avoid dumb calls to strlen
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 20 Jan 2015 10:24:09 +0000 (13:24 +0300)
committerDmitry Antipov <dmantipov@yandex.ru>
Tue, 20 Jan 2015 10:24:09 +0000 (13:24 +0300)
* nsfont.m (ns_get_family):
* nsterm.m (ns_term_init):
* w32fns.c (w32_window):
* xfns.c (x_window, Fx_select_font): Use xlispstrdup.

src/ChangeLog
src/nsfont.m
src/nsterm.m
src/w32fns.c
src/xfns.c

index b8528c27528521983363ab93fb33e5213a26136b..6257cc4277a5853e74e07e85e81486e92999a312 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-20  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Prefer xlispstrdup to avoid dumb calls to strlen.
+       * nsfont.m (ns_get_family):
+       * nsterm.m (ns_term_init):
+       * w32fns.c (w32_window):
+       * xfns.c (x_window, Fx_select_font): Use xlispstrdup.
+
 2015-01-20  Paul Eggert  <eggert@cs.ucla.edu>
 
        Correct an old fix for GTK font selection
index f5e89d32bfc9c0ca21065fefc3cdba26609d5dd1..683ab178836565a338402767f69ba7c134f02aea 100644 (file)
@@ -93,7 +93,7 @@ ns_get_family (Lisp_Object font_spec)
       return nil;
   else
     {
-      char *tmp = xstrdup (SSDATA (SYMBOL_NAME (tem)));
+      char *tmp = xlispstrdup (SYMBOL_NAME (tem));
       NSString *family;
       ns_unescape_name (tmp);
       family = [NSString stringWithUTF8String: tmp];
index bf3192bf43232fe679d17ce05890591938209610..b07fa1c31b00b479be05c33f6db8513f9b8f19a6 100644 (file)
@@ -4313,7 +4313,7 @@ ns_term_init (Lisp_Object display_name)
 
   dpyinfo->name_list_element = Fcons (display_name, Qnil);
 
-  terminal->name = xstrdup (SSDATA (display_name));
+  terminal->name = xlispstrdup (display_name);
 
   unblock_input ();
 
index 2dd92ff8a3acc8f04951b29d2dfeb9f145e42d03..55e58294629e5c085e04fa93cae34ef0181b7601 100644 (file)
@@ -4208,7 +4208,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
      for the window manager, so GC relocation won't bother it.
 
      Elsewhere we specify the window name for the window manager.  */
-  f->namebuf = xstrdup (SSDATA (Vx_resource_name));
+  f->namebuf = xlispstrdup (Vx_resource_name);
 
   my_create_window (f);
 
index 936c769a2de25c9debc603a18fb2ab3264112c5a..a09e4a6df63cb2947e09acf0db97d42e1773cced 100644 (file)
@@ -2238,7 +2238,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
      for the window manager, so GC relocation won't bother it.
 
      Elsewhere we specify the window name for the window manager.  */
-  f->namebuf = xstrdup (SSDATA (Vx_resource_name));
+  f->namebuf = xlispstrdup (Vx_resource_name);
 
   ac = 0;
   XtSetArg (al[ac], XtNallowShellResize, 1); ac++;
@@ -5995,12 +5995,12 @@ nil, it defaults to the selected frame. */)
   XSETFONT (font, FRAME_FONT (f));
   font_param = Ffont_get (font, intern (":name"));
   if (STRINGP (font_param))
-    default_name = xstrdup (SSDATA (font_param));
+    default_name = xlispstrdup (font_param);
   else
     {
       font_param = Fframe_parameter (frame, Qfont_param);
       if (STRINGP (font_param))
-        default_name = xstrdup (SSDATA (font_param));
+        default_name = xlispstrdup (font_param);
     }
 
   font = xg_get_font (f, default_name);