some cleanup

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

 



Hi all,

against current CVS:

- get rid of various compiler warnings
  (I'm sure gpm will become the prime example of good software engineering
  sometime, no ? :-)
- beautify/unify comments
- spelling fixes

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604                http://mohr.de.tt
Index: README
===================================================================
RCS file: /data/cvs/gpm/README,v
retrieving revision 1.4
diff -u -r1.4 README
--- README	2002/07/07 15:15:59	1.4
+++ README	2002/07/27 10:57:33
@@ -31,7 +31,7 @@
 =========== MAINTENANCE
 
 As of 1.19.4, gpm is officially maintained again. Most of the README is written
-by Alessandro Rubine, only minor changes are made by me.
+by Alessandro Rubini, only minor changes are made by me.
 
 =========== MAILING LIST
 
Index: src/mouse-test.c
===================================================================
RCS file: /data/cvs/gpm/src/mouse-test.c,v
retrieving revision 1.1
diff -u -r1.1 mouse-test.c
--- src/mouse-test.c	2002/05/27 15:36:48	1.1
+++ src/mouse-test.c	2002/07/27 10:57:33
@@ -199,7 +199,7 @@
    exit(1);
 }
 
-#define CHECKFAIL(count)   ((count)==0 && noneofthem())
+#define CHECKFAIL(count)   if (count==0) noneofthem();
 
 /***************************************
  * This is the most useful function in
Index: src/gpm.c
===================================================================
RCS file: /data/cvs/gpm/src/gpm.c,v
retrieving revision 1.2
diff -u -r1.2 gpm.c
--- src/gpm.c	2002/05/29 09:12:24	1.2
+++ src/gpm.c	2002/07/27 10:57:34
@@ -106,11 +106,11 @@
 static int mouse_argc[3]; /* 0 for default (unused) and two mice */
 static char **mouse_argv[3]; /* 0 for default (unused) and two mice */
 
-/*===================================================================*/
-/*
+/*-------------------------------------------------------------------*
+ *
  *      first, all the stuff that used to be in gpn.c (i.e., not main-loop)
- */
-/*-------------------------------------------------------------------*/
+ *
+ *-------------------------------------------------------------------*/
 
 /* build_argv is used for mouse initialization routines */
 static char **build_argv(char *argv0, char *str, int *argcptr, char sep)
@@ -145,10 +145,10 @@
    return argv;
 }
 
-/*-------------------------------------------------------------------*/
-/* The old console options is removed. We are taking stderr now
- * In the next update there should also be support for syslog
- ********************************************************************/
+/*-------------------------------------------------------------------*
+ * The old console options is removed. We are taking stderr now.
+ * In the next update there should also be support for syslog.
+ *-------------------------------------------------------------------*/
 
 static inline int open_console(const int mode)
 {
@@ -219,12 +219,13 @@
 }
 
 
-/*-------------------------------------------------------------------*/
-/* comment missing; FIXME */
-/*-------------------------------------------------------------------*/
+/*-------------------------------------------------------------------*
+ * tell the kernel to paste the currently selected content into
+ * the current console (via TIOCLINUX ioctl()).
+ *-------------------------------------------------------------------*/
 static inline void selection_paste(void)
 {
-   char c=3;
+   char c=3; /* TIOCLINUX func 3 == "paste_selection" */
    int fd;
 
    if (!opt_aged && (0 != opt_age_limit) &&
@@ -294,8 +295,9 @@
    return 0;
 }
 
-/*-------------------------------------------------------------------*/
-/* returns 0 if the event has not been processed, and 1 if it has */
+/*-------------------------------------------------------------------*
+ * returns 0 if the event has not been processed, and 1 if it has.
+ *-------------------------------------------------------------------*/
 static inline int do_client(Gpm_Cinfo *cinfo, Gpm_Event *event)
 {
    Gpm_Connect info=cinfo->data;
@@ -327,7 +329,7 @@
    return 0; /* no next, not used */
 }
 
-/*-------------------------------------------------------------------
+/*-------------------------------------------------------------------*
  * fetch the actual device data from the mouse device, dependent on
  * what Gpm_Type is being passed.
  *-------------------------------------------------------------------*/
@@ -392,7 +394,7 @@
 static int statusC=0; /* clicks */
 void get_console_size(Gpm_Event *ePtr);
 
-/*-------------------------------------------------------------------
+/*-------------------------------------------------------------------*
  * call getMouseData to get hardware device data, call mouse device's fun() 
  * to retrieve the hardware independent event data, then optionally repeat
  * the data via repeat_fun() to the repeater device
@@ -506,7 +508,7 @@
       return 0; /* no events nor information for clients */
    } /* first if of these three */
 
-/*....................................... no, we arent a repeater, go on */
+/*....................................... no, we aren't a repeater, go on */
 
    /* use fine delta values now, if delta is the information */
    if (!(m_type)->absolute) {
@@ -632,7 +634,7 @@
 }
 
 /*-------------------------------------------------------------------*
- * This  was inline, and incurred in a compiler bug (2.7.0)
+ * This was inline, and incurred in a compiler bug (2.7.0)
  *-------------------------------------------------------------------*/
 static int get_data(Gpm_Connect *where, int whence)
 {
@@ -928,7 +930,7 @@
    /*** initialization ***/
    prgname=argv[0];                       /* set prgname */
    consolename = Gpm_get_console();       /* get consolename */
-   if (geteuid() != 0)                    /* check whether we are ran as root */
+   if (geteuid() != 0)                    /* check whether we are run as root */
       gpm_report(GPM_PR_OOPS,GPM_MESS_ROOT); /* if not exit */
    cmdline(argc, argv);                   /* parse command line */
    atexit(gpm_exited);
@@ -1065,7 +1067,7 @@
 /*....................................... got mouse, process event */
 /*
  * Well, actually, run a loop to maintain inlining of functions without
- * lenghtening the file. This is not too clean a code, but it works....
+ * lenghtening the file.
  */
 
       for (i=1; i <= 1+opt_double; i++) {
@@ -1073,15 +1075,20 @@
          if (FD_ISSET(which_mouse->fd,&selSet)) {
             FD_CLR(which_mouse->fd,&selSet); pending--;
             if (processMouse(which_mouse->fd, &event, m_type, kd_mode))
-               /* pass it to the client, if any
-                * or to the default handler, if any
-                * or to the selection handler
-                */ /* FIXME -- check event.vc */
-               /* can't we please rewrite the following a bit nicer?*/
-               (cinfo[event.vc] && do_client(cinfo[event.vc], &event))
-               || (cinfo[0]        && do_client(cinfo[0],        &event))
-               ||  do_selection(&event);
-            }
+            {
+               /* pass it to the client, if any */
+               if (cinfo[event.vc])
+                  do_client(cinfo[event.vc], &event);
+               /* or to the default handler, if any */
+               else
+               if (cinfo[0])
+                  do_client(cinfo[0],        &event);
+               /* or to the selection handler */
+               else
+                  do_selection(&event);
+               /* FIXME -- check event.vc */
+             }
+         }
       }
 
       /*..................... got connection, process it */

[Index of Archives]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Gimp]     [Yosemite News]