summaryrefslogtreecommitdiffstats
path: root/runtime/docs/examples/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/docs/examples/list.c')
-rw-r--r--runtime/docs/examples/list.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/docs/examples/list.c b/runtime/docs/examples/list.c
index 15d13d4b..6294cccb 100644
--- a/runtime/docs/examples/list.c
+++ b/runtime/docs/examples/list.c
@@ -1,5 +1,5 @@
-struct map_node_str *ptr;
+struct map_node *ptr;
MAP map = _stp_list_new(10, STRING);
@@ -8,7 +8,10 @@ for (i = 0; i < 10; i++) {
_stp_list_add (map, buf);
}
+/* old way to print a list of strings */
foreach (map, ptr)
- printf ("map[%ld] = %s\n", key1int(ptr), ptr->str);
+ _stp_printf ("list[%ld] = %s\n", key1int(ptr), _stp_get_str(ptr));
+/* new way to print a list of strings */
+ _stp_map_print(map, "list[%1d] = %s");