summaryrefslogtreecommitdiffstats
path: root/runtime/map-int.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-10-26 08:29:38 +0000
committerhunt <hunt>2005-10-26 08:29:38 +0000
commitaf5dd76bca996577262e447fd8bff1bd0df30db7 (patch)
tree488419840e6841a1dcb022553cb33f6eccbbb3f5 /runtime/map-int.c
parentd7c99876fec8867918d9f4f808edca985eb1fd67 (diff)
downloadsystemtap-steved-af5dd76bca996577262e447fd8bff1bd0df30db7.tar.gz
systemtap-steved-af5dd76bca996577262e447fd8bff1bd0df30db7.tar.xz
systemtap-steved-af5dd76bca996577262e447fd8bff1bd0df30db7.zip
2005-10-26 Martin Hunt <hunt@redhat.com>
* map.c (_new_map_create, _new_map_del_node, _new_map_del_node, _new_map_set_int64, _new_map_set_str,_new_map_get_int64, _new_map_get_str, _new_map_get_stat, _new_map_set_stat): New internal functions for the new API. * map-int.c (__stp_map_set_int64): Modify to return an error code. * map-stat.c (_stp_map_add_stat): Ditto. * map-str (_stp_map_set_str): Ditto. * Doxyfile: Remove predefines NEED_STRING_VALS, NEED_STATS, NEED_INT64. * map-keys.c: Ditto. * list.c (_stp_list_new): Ditto. Also set map->list. * map-values.c: Ditto.
Diffstat (limited to 'runtime/map-int.c')
-rw-r--r--runtime/map-int.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/runtime/map-int.c b/runtime/map-int.c
index cf6363c6..574b29f7 100644
--- a/runtime/map-int.c
+++ b/runtime/map-int.c
@@ -12,27 +12,27 @@
* @brief Map functions to set and get int64s
*/
-void __stp_map_set_int64 (MAP map, int64_t val, int add)
+int __stp_map_set_int64 (MAP map, int64_t val, int add)
{
struct map_node *m;
if (map == NULL)
- return;
+ return -2;
if (map->create) {
- if (val == 0 && !map->no_wrap)
- return;
+ if (val == 0 && !map->list)
+ return 0;
m = __stp_map_create (map);
if (!m)
- return;
+ return -1;
/* set the value */
//dbug ("m=%lx offset=%lx\n", (long)m, (long)map->data_offset);
*(int64_t *)((long)m + map->data_offset) = val;
} else {
if (map->key == NULL)
- return;
+ return -2;
if (val) {
if (add)
@@ -44,6 +44,7 @@ void __stp_map_set_int64 (MAP map, int64_t val, int add)
_stp_map_key_del(map);
}
}
+ return 0;
}
/** Set the current element's value to an int64.
* This sets the current element's value to an int64. The map must have been created
@@ -53,6 +54,7 @@ void __stp_map_set_int64 (MAP map, int64_t val, int add)
* is set for the map, this function does nothing.
* @param map
* @param val new value
+ * @returns \li \c 0 on success \li \c -1 on overflow \li \c -2 on bad map or key
* @sa _stp_map_add_int64()
* @sa _stp_map_set()
* @ingroup map_set