emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

your emacs.c checkin


From: Dan Nicolaescu
Subject: your emacs.c checkin
Date: Fri, 23 Jan 2009 05:39:27 -0800 (PST)

Hi,

I noticed a few things in your recent checkin.

This log entry:

revision 1.460
date: 2009-01-23 09:58:02 +0000;  author: arobert;  state: Exp;  lines: +14 -0; 
 commitid: uR5DiDFacrhnIyzt;
* emacs.c (ns_no_defaults): New declaration.  (main): Use it.  * nsterm.h 
(ns_no_defaults): New declaration.  * nsfns.m (x_get_string_resource): Don't 
read when ns_no_defaults.  * nsterm.m (ns_no_defaults): New variable.  
(ns_initialize): Don't read defaults when ns_no_defaults.

seems to be line wrapped, it happens for your other log entries.  Can
you please avoid this, it makes it hard to read.


Index: emacs.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/emacs.c,v
retrieving revision 1.458
retrieving revision 1.459
diff -u -3 -p -c -r1.458 -r1.459
cvs diff: conflicting specifications of output style
*** emacs.c     8 Jan 2009 03:15:35 -0000       1.458
--- emacs.c     23 Jan 2009 09:12:53 -0000      1.459
*************** main (int argc, char **argv)
*** 797,802 ****
--- 797,805 ----
    int no_loadup = 0;
    char *junk = 0;
    char *dname_arg = 0;
+ #ifdef NS_IMPL_COCOA
+   char dname_arg2[80];
+ #endif

This can be moved inside the only block that uses it.

  
  #if GC_MARK_STACK
    extern Lisp_Object *stack_base;
*************** main (int argc, char **argv)
*** 1108,1114 ****
--- 1111,1129 ----
          exit (1);
        }
  
+ #ifndef NS_IMPL_COCOA
        f = fork ();
+ #else

Please use
+ #else /* not NS_IMPL_COCOA */


+       /* Under Cocoa we must do fork+exec:
+    
(http://developer.apple.com/ReleaseNotes/CoreFoundation/CoreFoundation.html)

Please add a brief explanation why this is done inline here so that it's not 
necessary to go
online and read the documentation. 


+          We mark being in the exec'd process by a daemon name argument of

"exec'd" is an interesting spelling, but it's not used anywhere else in
emacs, please use something more standard.

+          form "--daemon=\nFD0,FD1\nNAME" where FD are the pipe file 
descriptors,
+          NAME is the original daemon name, if any. */
+       if (!dname_arg || !strchr (dname_arg, '\n'))
+         f = fork ();  /* in orig */
+       else
+         f = 0;  /* in exec'd */
+ #endif 

Please use:
+ #endif  /* not NS_IMPL_COCOA */

        if (f > 0)
        {
          int retval;
*************** main (int argc, char **argv)
*** 1144,1149 ****
--- 1159,1200 ----
          exit (1);
        }
  
This block can be moved out of line in a function so that the code is
easier to read:

+ #ifdef NS_IMPL_COCOA
+       {
+         /* in orig process, forked as child, OR in exec'd */

Comments need to start with a capital, end with . and should be full
sentences. 

+         if (!dname_arg || !strchr (dname_arg, '\n'))
+           {  /* in orig, child: now exec w/special daemon name */
+             char fdStr[80];
+ 
+             if (dname_arg && strlen (dname_arg) > 70)
+               {
+                 fprintf (stderr, "daemon: child name too long\n");
+                 exit (1);
+               }
+ 
+             sprintf (fdStr, "--daemon=\n%d,%d\n%s", daemon_pipe[0],
+                      daemon_pipe[1], dname_arg ? dname_arg : "");
+             argv[skip_args] = fdStr;
+ 
+             execv (argv[0], argv);
+             fprintf (stderr, "emacs daemon: exec failed: %d\t%d\n", errno);
+             exit (1);
+           }
+ 
+         /* in exec'd: parse special dname into pipe and name info */
+         if (!dname_arg || !strchr (dname_arg, '\n')
+             || strlen (dname_arg) < 1 || strlen (dname_arg) > 70)
+           {
+             fprintf (stderr, "emacs daemon: daemon name absent or too 
long\n");
+             exit(1);
+           }
+         dname_arg2[0] = '\0';
+         sscanf (dname_arg, "\n%d,%d\n%s", &(daemon_pipe[0]), 
&(daemon_pipe[1]),
+                 dname_arg2);
+         dname_arg = strlen (dname_arg2) ? dname_arg2 : NULL;
+       }
+ #endif
+ 
        if (dname_arg)
                daemon_name = xstrdup (dname_arg);
        /* Close unused reading end of the pipe.  */






reply via email to

[Prev in Thread] Current Thread [Next in Thread]