[GRASS-SVN] r63097 - in grass/branches/releasebranch_7_0: include/defs lib/linkm

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 26 08:11:51 PST 2014


Author: neteler
Date: 2014-11-26 08:11:51 -0800 (Wed, 26 Nov 2014)
New Revision: 63097

Modified:
   grass/branches/releasebranch_7_0/include/defs/linkm.h
   grass/branches/releasebranch_7_0/lib/linkm/README
   grass/branches/releasebranch_7_0/lib/linkm/new.c
Log:
linkmlib: clarify linkm usage (trunk, r59775)

Modified: grass/branches/releasebranch_7_0/include/defs/linkm.h
===================================================================
--- grass/branches/releasebranch_7_0/include/defs/linkm.h	2014-11-26 16:10:42 UTC (rev 63096)
+++ grass/branches/releasebranch_7_0/include/defs/linkm.h	2014-11-26 16:11:51 UTC (rev 63097)
@@ -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/branches/releasebranch_7_0/lib/linkm/README
===================================================================
--- grass/branches/releasebranch_7_0/lib/linkm/README	2014-11-26 16:10:42 UTC (rev 63096)
+++ grass/branches/releasebranch_7_0/lib/linkm/README	2014-11-26 16:11:51 UTC (rev 63097)
@@ -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/branches/releasebranch_7_0/lib/linkm/new.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/linkm/new.c	2014-11-26 16:10:42 UTC (rev 63096)
+++ grass/branches/releasebranch_7_0/lib/linkm/new.c	2014-11-26 16:11:51 UTC (rev 63097)
@@ -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