Felix Fietkau
77a629375d
blob/blobmsg: add explicit typecasts for attribute iterators
...
Fixes C++ compatibility.
Reported in https://forum.lede-project.org/t/blobmsg-for-each-attr-from-c/389
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-11-29 14:02:57 +01:00
Matthias Schiffer
1f019ceea1
Fix various memory management issues
...
Consistently handle allocation failures. Some functions are changed to
return bool or int instead of void to allow returning an error.
Also fix a buffer size miscalculation in lua/uloop and use _exit() instead
of exit() on errors after forking.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-06-26 12:53:51 +02:00
Felix Fietkau
042f1a2546
blobmsg: accept NULL attr in blobmsg_get_string()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-08-03 15:00:54 +02:00
Felix Fietkau
f3977836af
blobmsg: add a helper function to reset the name of a blobmsg attribute
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-21 01:24:01 +02:00
Felix Fietkau
7ba1f8acd8
blobmsg: add blobmsg_check_array, which returns the size of the array
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-15 10:52:12 +02:00
Jacob Siverskog
4436338588
blob/blobmsg: Perform explicit casts from void* to avoid compilation errors when using libubox from C++.
...
Signed-off by: Jacob Siverskog <jacob@teenageengineering.com>
2014-05-09 14:33:39 +02:00
Felix Fietkau
d07b174de8
blobmsg: make length variables unsigned
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-27 16:32:09 +02:00
Felix Fietkau
58aec3c59a
blobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements
...
This primarily helps with simplifying the ubus APIs.
blobmsg header presence is indicated by the BLOB_ATTR_EXTENDED bit in
the id_len field.
This changes the format ABI, but not the API.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-12 20:18:12 +01:00
Felix Fietkau
914ef8f6b0
blobmsg: add blobmsg_len() for consistency (similar to blob_len)
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-20 13:19:51 +02:00
Felix Fietkau
ef9b6b92df
blob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix formatting
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-29 14:44:11 +02:00
Felix Fietkau
af2f52a37b
blobmsg: implement blobmsg_printf and blobmsg_vprintf
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-17 16:42:12 +01:00
Felix Fietkau
4ab499899c
blobmsg: add blobmsg_realloc_string_buffer()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 20:43:51 +01:00
Felix Fietkau
8a89e7f388
blob/blobmsg: use 32 bit load/store for 64 bit access, unaligned attributes cause data corruption on ARM
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-23 02:41:20 +01:00
Felix Fietkau
c360ec576c
blobmsg: add blobmsg_get_string
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 15:29:14 +01:00
Felix Fietkau
2f74dbad14
blobmsg: add blobmsg_parse_array()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-08 02:05:03 +01:00
Felix Fietkau
bbdc3bdb05
blobmsg: remove the unnecessary name argument from blobmsg_check_attr_list, infer it from the list type
2012-06-24 21:11:06 +02:00
Felix Fietkau
f1494cde4d
blobmsg: add blobmsg_check_attr_list() to validate element types of arrays and tables
2012-06-24 21:07:47 +02:00
Felix Fietkau
74cdaf796f
switch blobmsg over to permissive license
2012-05-26 18:02:30 +02:00
Felix Fietkau
f8d3e57b45
add blobmsg_add_blob() to copy over an existing blobmsg attribute
2012-05-08 15:59:19 +02:00
Felix Fietkau
f565a7af42
blobmsg: add missing endian conversions
2011-11-17 00:47:54 +01:00
Felix Fietkau
fc20c7a031
make casts from void * explicit to avoid C++ warnings (patch by Arthur Davis)
2011-10-27 10:16:56 +02:00
Felix Fietkau
08aada9a93
make the blobmsg format endian agnostic (stick to big-endian)
2011-10-06 17:15:00 +02:00
Felix Fietkau
591a1e349f
fix reads beyond the end of the buffer when iterating over blob attributes
2011-10-03 12:36:46 +02:00
Felix Fietkau
8cada85b61
add a blobmsg_type() inline function
2011-09-12 13:37:53 +02:00
Felix Fietkau
dee81b4f79
add blobmsg_get_bool
2011-09-07 06:33:36 +02:00
Felix Fietkau
abbc140e8d
add BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8
2011-07-29 12:56:48 +02:00
Felix Fietkau
0918243e90
move json formatting to the blobmsg_json library
2011-02-06 21:23:28 +01:00
Felix Fietkau
01ad5162b2
add a callback to the blobmsg-to-json function to override the formatting of specific attributes
2011-02-06 16:48:28 +01:00
Felix Fietkau
5aed3c2d2e
blomsg: add integer attribute accessor functions
2011-02-05 02:06:49 +01:00
Felix Fietkau
29598e3dc8
add functions for allocating and adding a string buffer field
2011-02-04 21:57:59 +01:00
Felix Fietkau
7a0571a9ff
blobmsg: constify and add more validation
2011-01-31 03:51:06 +01:00
Felix Fietkau
da2876acd9
add support for json-formatting blobmsg elements
2011-01-30 14:15:57 +01:00
Felix Fietkau
ff585b97c0
fix json list parsing
2011-01-30 01:13:32 +01:00
Felix Fietkau
2d9f917d00
add blobmsg_for_each_attr
2011-01-29 18:16:12 +01:00
Felix Fietkau
5129bc9401
blobmsg: make arrays structually the same as tables - simplifies library user code
2011-01-29 18:00:40 +01:00
Felix Fietkau
d28eb7fc28
add a blobmsg-to-json function
2011-01-23 22:52:53 +01:00
Felix Fietkau
fcee2d56bc
add blobmsg_name()
2011-01-23 20:06:03 +01:00
Felix Fietkau
71f0be5e11
add blobmsg validation function
2011-01-23 19:55:41 +01:00
Felix Fietkau
6370c3e636
add BLOBMSG_TYPE_LAST
2010-12-29 15:08:45 +01:00
Felix Fietkau
e82d74f898
Initial import
2010-10-13 21:29:08 +02:00