[GRASS-SVN] r59775 - in grass/trunk: include/defs lib/linkm

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 17 11:29:14 PDT 2014


Author: mmetz
Date: 2014-04-17 11:29:14 -0700 (Thu, 17 Apr 2014)
New Revision: 59775

Modified:
   grass/trunk/include/defs/linkm.h
   grass/trunk/lib/linkm/README
   grass/trunk/lib/linkm/new.c
Log:
linkmlib: clarify linkm usage

Modified: grass/trunk/include/defs/linkm.h
===================================================================
--- grass/trunk/include/defs/linkm.h	2014-04-17 18:23:04 UTC (rev 59774)
+++ grass/trunk/include/defs/linkm.h	2014-04-17 18:29:14 UTC (rev 59775)
@@ -14,8 +14,10 @@
 void link_cleanup(struct link_head *);
 
 /* new.c */
-struct link_head *link_new(struct link_head *);
+VOID_T *link_new(struct link_head *);
 
+
+/* for internal use only */
 /* next.c */
 VOID_T *link__get_next(VOID_T *);
 void link__set_next(VOID_T *, VOID_T *);

Modified: grass/trunk/lib/linkm/README
===================================================================
--- grass/trunk/lib/linkm/README	2014-04-17 18:23:04 UTC (rev 59774)
+++ grass/trunk/lib/linkm/README	2014-04-17 18:29:14 UTC (rev 59775)
@@ -45,7 +45,17 @@
 
 Interface:
 
+	The link structure must have the following form:
 
+	struct my_linked_list
+	{
+	    struct my_linked_list *next;
+	    <data_type> data;
+	    /* optional other data */
+	};
+
+	The link to the next item MUST be the first entry.
+
 void *
 link_init (int size)
 
@@ -65,19 +75,20 @@
 
 
 void
-link_cleanup (void *token)
+link_cleanup (struct link_head *token)
     
 	Clean up all memory when done using the list.
 	should only be called once per list per run for best performance.
 	Pass it the token returned by link_init () 
 
 void *
-link_new (void *token)
+link_new (struct link_head *token)
 	
 	return a new memory slot, 'size' bytes long as specified by link_init()
 	This return pointer should be cast to your link structure type.
 
-link_dispose (void *token, void *ptr)
+void
+link_dispose (struct link_head *token, void *ptr)
 	
 	pass it the token and a pointer to the structure to be de-allocated.
 	The memory is returned to the memory manager.

Modified: grass/trunk/lib/linkm/new.c
===================================================================
--- grass/trunk/lib/linkm/new.c	2014-04-17 18:23:04 UTC (rev 59774)
+++ grass/trunk/lib/linkm/new.c	2014-04-17 18:29:14 UTC (rev 59775)
@@ -9,7 +9,7 @@
 #include <grass/linkm.h>
 
 
-struct link_head *link_new(struct link_head *Head)
+VOID_T *link_new(struct link_head *Head)
 {
     VOID_T *tmp;
     char *ctmp, *p;



More information about the grass-commit mailing list