bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] libps: code clean up.


From: Neal H Walfield
Subject: [PATCH] libps: code clean up.
Date: Sat, 31 Mar 2001 10:47:41 +0200
User-agent: Mutt/1.3.15i

Code clean up.


2001-03-29  Neal H Walfield  <neal@cs.uml.edu>

        * host.c: Fix comments.
        (ps_host_basic_info): Make initialized static, otherwise,
        we never cache buf.  Do not initalize static variables to 0.
        (ps_host_sched_info): Likewise.
        * ps.h: Doc fix.


diff -urN hurd-20010329-snapshot/libps/host.c hurd-20010313/libps/host.c
--- hurd-20010329-snapshot/libps/host.c Wed Mar 27 00:08:27 1996
+++ hurd-20010313/libps/host.c  Fri Mar 30 15:14:14 2001
@@ -1,8 +1,8 @@
 /* Routines to get global host info.
 
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2001 Free Software Foundation, Inc.
 
-   Written by Miles Bader <miles@gnu.ai.mit.edu>
+   Written by Miles Bader <miles@gnu.org>
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -29,8 +29,8 @@
 /* ---------------------------------------------------------------- */
 
 /*
-   The Basic & Sched info types are pretty static, so we cache them, but load
-   info is dynamic so we don't cache that.
+   The Basic & Sched info types are pretty must static so we cache them.
+   However, as load info is dynamic, we do not cache it.
 
    See <mach/host_info.h> for information on the data types these routines
    return.
@@ -46,13 +46,14 @@
   return host;
 }
 
-/* Return a pointer to basic info about the current host in INFO.  Since
-   this is static global information we just use a static buffer.  If a
-   system error occurs, the error code is returned, otherwise 0.  */
+/* Return a pointer to the basic info about the current host in INFO.
+   Since this is static global information, we just use a static buffer.
+   If a system error occurs, the error code is returned, otherwise 0 is
+   returned.  */
 error_t
 ps_host_basic_info (host_basic_info_t *info)
 {
-  int initialized = FALSE;
+  static int initialized;
   static host_basic_info_data_t buf;
 
   if (!initialized)
@@ -62,20 +63,21 @@
                              (host_info_t) &buf, &size);
       if (err)
        return err;
-      initialized = TRUE;
+      initialized = 1;
     }
 
   *info = &buf;
   return 0;
 }
 
-/* Return a pointer to scheduling info about the current host in INFO.
-   Since this is static global information we just use a static buffer.  If a
-   system error occurs, the error code is returned, otherwise 0.  */
+/* Return a pointer to the scheduling info about the current host in INFO.
+   Since this is static global information, we just use a static buffer.
+   If a system error occurs, the error code is returned, otherwise 0 is
+   returned.  */
 error_t
 ps_host_sched_info (host_sched_info_t *info)
 {
-  int initialized = FALSE;
+  static int initialized;
   static host_sched_info_data_t buf;
 
   if (!initialized)
@@ -85,17 +87,17 @@
                              (host_info_t) &buf, &size);
       if (err)
        return err;
-      initialized = TRUE;
+      initialized = 1;
     }
 
   *info = &buf;
   return 0;
 }
 
-/* Return a pointer to load info about the current host in INFO.  Since
-   this is global information we just use a static buffer (if someone desires
-   to keep old load info, they should copy the buffer we return a pointer
-   to).  If a system error occurs, the error code is returned, otherwise 0.  */
+/* Return a pointer to the load info about the current host in INFO.  Since
+   this is global information, we just use a static buffer (if someone desires
+   to keep old load info, they should copy the returned buffer).  If a system
+   error occurs, the error code is returned, otherwise 0 is returned.  */
 error_t
 ps_host_load_info (host_load_info_t *info)
 {
diff -urN hurd-20010329-snapshot/libps/ps.h hurd-20010313/libps/ps.h
--- hurd-20010329-snapshot/libps/ps.h   Wed Jun  2 08:24:36 1999
+++ hurd-20010313/libps/ps.h    Sat Mar 17 18:05:07 2001
@@ -40,7 +40,7 @@
   uid_t uid;
 
   /* The status */
-     enum ps_user_passwd_state passwd_state;
+  enum ps_user_passwd_state passwd_state;
 
   /* The user's password file entry.  Only valid if PASSWD_STATE ==
      PS_USER_PASSWD_OK.  */

Attachment: pgpYghWFKgoP9.pgp
Description: PGP signature


reply via email to

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