(close): Rename to do_close to avoid conflict with POSIX function of
[pspp] / src / libpspp / pool.c
index d4c00b38037a6d754dbde33b6cb5774d3aebe891..141d8ab40323b94fea587ce801369bde6938b7aa 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 2000 Free Software Foundation, Inc.
 /* PSPP - computes sample statistics.
    Copyright (C) 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@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
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -101,8 +100,8 @@ union align
 
 /* DISCRETE_BLOCKS may be declared as nonzero to prevent
    suballocation of blocks.  This is useful under memory
 
 /* DISCRETE_BLOCKS may be declared as nonzero to prevent
    suballocation of blocks.  This is useful under memory
-   debuggers like Checker or valgrind because it allows the
-   source location of bugs to be more accurately pinpointed.
+   debuggers like valgrind because it allows the source location
+   of bugs to be more accurately pinpointed.
 
    On the other hand, if we're testing the library, then we want to
    test the library's real functionality, not its crippled, slow,
 
    On the other hand, if we're testing the library, then we want to
    test the library's real functionality, not its crippled, slow,
@@ -700,8 +699,8 @@ pool_fopen (struct pool *pool, const char *file_name, const char *mode)
 
   assert (pool && file_name && mode);
   f = fopen (file_name, mode);
 
   assert (pool && file_name && mode);
   f = fopen (file_name, mode);
-  if (f == NULL)
-    return NULL;
+  if (f != NULL)
+    pool_attach_file (pool, f);
 
   return f;
 }
 
   return f;
 }
@@ -777,8 +776,8 @@ pool_register (struct pool *pool, void (*free) (void *), void *p)
 }
 
 /* Unregisters previously registered P from POOL.
 }
 
 /* Unregisters previously registered P from POOL.
-   Returns nonzero only if P was found to be registered in POOL. */
-int
+   Returns true only if P was found to be registered in POOL. */
+bool
 pool_unregister (struct pool *pool, void *p)
 {
   assert (pool && p);
 pool_unregister (struct pool *pool, void *p)
 {
   assert (pool && p);
@@ -790,11 +789,11 @@ pool_unregister (struct pool *pool, void *p)
       if (g->type == POOL_GIZMO_REGISTERED && g->p.registered.p == p)
        {
          delete_gizmo (pool, g);
       if (g->type == POOL_GIZMO_REGISTERED && g->p.registered.p == p)
        {
          delete_gizmo (pool, g);
-         return 1;
+         return true;
        }
   }
   
        }
   }
   
-  return 0;
+  return false;
 }
 \f
 /* Partial freeing. */
 }
 \f
 /* Partial freeing. */