summaryrefslogtreecommitdiffstats
path: root/include/libnftnl/object.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2024-03-14 16:54:55 +0100
committerPhil Sutter <phil@nwl.cc>2024-04-11 01:27:07 +0200
commit691f90223712426a2babdb55d7e5526b7310ca6e (patch)
tree8f18de940350f441438112cb7f6b92532bbf516a /include/libnftnl/object.h
parent8b9b16b3658ed035523156198798b5f29c808c78 (diff)
obj: Return value on setters
Similar to other setters, let callers know if memory allocation fails. Though return value with all setters, as all of them may be used to set object type-specific attributes which may fail (e.g. if NFTNL_OBJ_TYPE was not set before). Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'include/libnftnl/object.h')
-rw-r--r--include/libnftnl/object.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/libnftnl/object.h b/include/libnftnl/object.h
index 4b2d90f..e235fdf 100644
--- a/include/libnftnl/object.h
+++ b/include/libnftnl/object.h
@@ -123,14 +123,14 @@ void nftnl_obj_free(const struct nftnl_obj *ne);
bool nftnl_obj_is_set(const struct nftnl_obj *ne, uint16_t attr);
void nftnl_obj_unset(struct nftnl_obj *ne, uint16_t attr);
-void nftnl_obj_set_data(struct nftnl_obj *ne, uint16_t attr, const void *data,
- uint32_t data_len);
+int nftnl_obj_set_data(struct nftnl_obj *ne, uint16_t attr, const void *data,
+ uint32_t data_len);
void nftnl_obj_set(struct nftnl_obj *ne, uint16_t attr, const void *data) __attribute__((deprecated));
-void nftnl_obj_set_u8(struct nftnl_obj *ne, uint16_t attr, uint8_t val);
-void nftnl_obj_set_u16(struct nftnl_obj *ne, uint16_t attr, uint16_t val);
-void nftnl_obj_set_u32(struct nftnl_obj *ne, uint16_t attr, uint32_t val);
-void nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val);
-void nftnl_obj_set_str(struct nftnl_obj *ne, uint16_t attr, const char *str);
+int nftnl_obj_set_u8(struct nftnl_obj *ne, uint16_t attr, uint8_t val);
+int nftnl_obj_set_u16(struct nftnl_obj *ne, uint16_t attr, uint16_t val);
+int nftnl_obj_set_u32(struct nftnl_obj *ne, uint16_t attr, uint32_t val);
+int nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val);
+int nftnl_obj_set_str(struct nftnl_obj *ne, uint16_t attr, const char *str);
const void *nftnl_obj_get_data(const struct nftnl_obj *ne, uint16_t attr,
uint32_t *data_len);
const void *nftnl_obj_get(const struct nftnl_obj *ne, uint16_t attr);