commit-gnue
[Top][All Lists]
Advanced

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

gnue/geas/src/objectcache objectcache.c


From: Reinhard Mueller
Subject: gnue/geas/src/objectcache objectcache.c
Date: Tue, 12 Jun 2001 04:17:24 -0700

CVSROOT:        /cvs
Module name:    gnue
Changes by:     Reinhard Mueller <address@hidden>       01/06/12 04:17:24

Modified files:
        geas/src/objectcache: objectcache.c 

Log message:
        Added some comments

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectcache/objectcache.c.diff?cvsroot=OldCVS&tr1=1.51&tr2=1.52&r1=text&r2=text

Patches:
Index: gnue/geas/src/objectcache/objectcache.c
diff -u gnue/geas/src/objectcache/objectcache.c:1.51 
gnue/geas/src/objectcache/objectcache.c:1.52
--- gnue/geas/src/objectcache/objectcache.c:1.51        Sun Jun 10 22:19:26 2001
+++ gnue/geas/src/objectcache/objectcache.c     Tue Jun 12 04:17:24 2001
@@ -19,7 +19,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
    
-   $Id: objectcache.c,v 1.51 2001/06/11 05:19:26 treshna Exp $
+   $Id: objectcache.c,v 1.52 2001/06/12 11:17:24 reinhard Exp $
 */
 
 #include "config.h"
@@ -77,7 +77,9 @@
 
 void _fill_values (gchar * key, _FieldData * field, GHashTable * values);
 
-/* used to clear all data from the cache */
+/* ------------------------------------------------------------------------- *\
+ * used to clear all data from the cache
+\* ------------------------------------------------------------------------- */
 void
 oc_empty_cache ()
 {
@@ -86,6 +88,9 @@
   cache_max_size = maxlen;
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Make the cache smaller
+\* ------------------------------------------------------------------------- */
 void
 oc_shrink_cache (unsigned int new_max_length)
 {
@@ -116,6 +121,9 @@
   timer_done_operation( TIMER_CACHE );
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Make the cache larger
+\* ------------------------------------------------------------------------- */
 void
 oc_extend_cache (unsigned int new_max_length)
 {
@@ -204,7 +212,9 @@
   timer_done_operation( TIMER_CACHE );
 }
 
-/* allocate/free cache */
+/* ------------------------------------------------------------------------- *\
+ * Allocate object cache memory
+\* ------------------------------------------------------------------------- */
 void
 create_object_cache (guint32 max_length)
 {
@@ -220,6 +230,9 @@
   objectcache_count = 0;
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Free object cache memory
+\* ------------------------------------------------------------------------- */
 void
 free_object_cache ()
 {
@@ -227,7 +240,13 @@
   fatal_error ("Not yet implemented");
 }
 
-/* Searching */
+/* ========================================================================= *\
+ * Searching
+\* ========================================================================= */
+
+/* ------------------------------------------------------------------------- *\
+ * Find an object by the key, no matter if it's cached or not
+\* ------------------------------------------------------------------------- */
 ObjectData *
 oc_find_object_by_key (const char *classname, const char *key)
 {
@@ -253,6 +272,9 @@
   return (obj);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Find a cached object by the key
+\* ------------------------------------------------------------------------- */
 ObjectData *
 oc_find_cached_object_by_key (const char *classname, const char *key)
 {
@@ -279,8 +301,13 @@
   return (obj);
 }
 
-/* Object management */
-
+/* ========================================================================= *\
+ * Object management
+\* ========================================================================= */
+
+/* ------------------------------------------------------------------------- *\
+ * Add a new, empty object to the cache
+\* ------------------------------------------------------------------------- */
 ObjectData *
 oc_add_empty_object (const char *classname, const char *key)
 {
@@ -346,6 +373,9 @@
   return (obj);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Remove an object from the cache
+\* ------------------------------------------------------------------------- */
 gboolean
 oc_remove_object (ObjectData * object)
 {
@@ -385,6 +415,9 @@
   return (TRUE);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Delete an object from the cache and from the database
+\* ------------------------------------------------------------------------- */
 gboolean
 oc_delete_object (const char *classname, const char *keystr)
 {
@@ -417,18 +450,27 @@
   return (TRUE);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Get the classname of an object
+\* ------------------------------------------------------------------------- */
 const char *
 oc_get_object_class (ObjectData * object)
 {
   return (object->classname);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Get the key of an object
+\* ------------------------------------------------------------------------- */
 const char *
 oc_get_object_key (ObjectData * object)
 {
   return (object->key);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * See if a key exists in a given class
+\* ------------------------------------------------------------------------- */
 gboolean
 oc_validate_object (const char *classname, const char *keystr)
 {
@@ -439,6 +481,9 @@
     return (FALSE);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Flush an object into the database
+\* ------------------------------------------------------------------------- */
 void
 _fill_values (gchar * key, _FieldData * field, GHashTable * values)
 {
@@ -479,7 +524,13 @@
   timer_done_operation( TIMER_CACHE );
 }
 
-/* Object flags */
+/* ========================================================================= *\
+ * Object flags
+\* ========================================================================= */
+
+/* ------------------------------------------------------------------------- *\
+ * Set an object flag
+\* ------------------------------------------------------------------------- */
 void
 oc_set_object_flag (ObjectData * object, enum object_flag flag,
                     gboolean state)
@@ -497,6 +548,9 @@
 
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Read an object flag
+\* ------------------------------------------------------------------------- */
 gboolean
 oc_get_object_flag (ObjectData * object, enum object_flag flag)
 {
@@ -511,7 +565,13 @@
   return (FLAG_OFF);
 }
 
-/* Data access */
+/* ========================================================================= *\
+ * Data access
+\* ========================================================================= */
+
+/* ------------------------------------------------------------------------- *\
+ * Get the data of a field of an object
+\* ------------------------------------------------------------------------- */
 char *
 oc_get_object_field (ObjectData * object, const char *fieldname)
 {
@@ -656,6 +716,9 @@
   return (NULL);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Set the data of a field of the object
+\* ------------------------------------------------------------------------- */
 gboolean
 oc_set_object_field (ObjectData * object, const char *fieldname,
                      const char *value, gboolean readonly)
@@ -770,6 +833,9 @@
   return (FALSE);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Free the memory of an object in cache
+\* ------------------------------------------------------------------------- */
 static void
 oc_free_object_data (_ObjectData * o)
 {
@@ -820,6 +886,9 @@
     }
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Allocate the memory for an object in cache
+\* ------------------------------------------------------------------------- */
 static _ObjectData *
 oc_allocate_object_data (const char *classname, const char *key)
 {
@@ -850,6 +919,9 @@
   return (o);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Allocate memory for a filed of an object
+\* ------------------------------------------------------------------------- */
 static _FieldData *
 oc_alloc_field_data (const char *name)
 {
@@ -871,6 +943,9 @@
   return (f);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Free the memory of a filed of an object
+\* ------------------------------------------------------------------------- */
 static void
 oc_free_field_data (gpointer key, _FieldData * f, gpointer userdata)
 {
@@ -889,6 +964,9 @@
     }
 }
 
+/* ------------------------------------------------------------------------- *\
+ * Read objects from the database and put the data in the cache
+\* ------------------------------------------------------------------------- */
 static ObjectData *
 oc_objectstore_query_to_objectcache (QueryData * q)
 {
@@ -951,6 +1029,9 @@
   return (first);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static oc_index_identifier *
 oc_make_index_identifier (_ObjectData * object, _odl_index * i)
 {
@@ -980,6 +1061,9 @@
   return (id);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static void
 oc_free_index_identifier_list (GList * list)
 {
@@ -1012,6 +1096,9 @@
     }
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static void
 oc_remove_from_index (_CacheIndex * idx, _ObjectData * o)
 {
@@ -1059,6 +1146,9 @@
   g_free (objhash);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static void
 oc_add_object_to_index (_ObjectData * object, oc_index_identifier * indexid)
 {
@@ -1301,6 +1391,9 @@
   return (link->objects->data);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 GList *
 oc_search_for_objects (_QueryData * q)
 {
@@ -1309,6 +1402,9 @@
   return (NULL);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static char *
 oc_make_object_index_hash (_ObjectData * object, _odl_index * idx)
 {
@@ -1370,8 +1466,10 @@
     }
   return (retval);
 }
-
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static GList *
 oc_object_to_start_of_list (GList * l, ObjectData * obj)
 {
@@ -1394,6 +1492,9 @@
   return (l);
 }
 
+/* ------------------------------------------------------------------------- *\
+ * 
+\* ------------------------------------------------------------------------- */
 static GList *
 oc_object_to_end_of_list (GList * l, ObjectData * obj)
 {



reply via email to

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