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
4bc1a3a46b
jshn: add json_get_keys()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-20 00:00:42 +02:00
Felix Fietkau
734d28eb1a
ustream: properly clear fields to fix ustream reuse
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-19 18:20:03 +02:00
Felix Fietkau
458c3937bc
blob: add a magic offset to nesting cookies to ensure that NULL is never returned as a normal value
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-16 01:22:02 +02:00
Felix Fietkau
e9fb256ca5
vlist: constify key argument to vlist_add
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-05 21:40:04 +02:00
Felix Fietkau
76906bec1c
blobmsg_json: allow signed output of integers
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-04 16:55:45 +02:00
Felix Fietkau
be458596bd
blob: add blob_put_raw() for copying one or more blob attributes into the buffer directly
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-04 16:55:45 +02:00
Felix Fietkau
460d94d6e8
blobmsg-example: fix length handling in dump_table() calls
2013-09-11 17:59:33 +02:00
Felix Fietkau
04f194aa8a
uloop: fix deleting pending fd events on uloop_fd_del
...
When a fd gets deleted internally due to errors, fd->registered gets set
to false before events are moved to the staging array.
This leads to pending events not getting cleared properly when the fd
user finally calls uloop_fd_del.
Fix this by moving the check down and always checking for pending
events.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-08-01 00:01:40 +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
Helmut Schaa
510e4956e5
uloop: Fix incorrect timeout
...
uloop timeouts are calculated based on a time value that was fetched
before any callbacks were executed. Hence, the next timeout is off by
the time the callback execution took which can lead to strange side
effects.
Fix this by calculating the next timeout based on a fresh time value.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2013-07-24 15:01:19 +02:00
John Crispin
11e8afea0f
runqueue should cal the complete handler from more places
...
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-07-02 18:33:46 +02:00
Felix Fietkau
316e3fb6c2
safe_list: add missing null pointer check in safe_list_del()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-28 13:05:06 +02:00
Felix Fietkau
c434230a76
ustream: return NULL in ustream_get_read_buf if there's a buffer, but no data
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 19:53:09 +02:00
Felix Fietkau
6f192a6fb0
blobmsg_json: do not corrupt UTF-8 strings
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 17:19:37 +02:00
Felix Fietkau
7c5d2b3081
blobmsg_json: fix \u escaping for control characters
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 17:06:34 +02:00
Felix Fietkau
b9ebdbcc64
uloop: fix corner cases with recursive uloop_run calls
...
With multiple recursive calls to uloop_run, the callback for the same fd
can be run multiple times from different levels in the stack.
Prevent this by tracking the stack of uloop_fd callbacks and buffering new
incoming events for fds already on the stack.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-18 12:05:09 +02:00
Felix Fietkau
35cee2c206
uloop: fix event flags processing on mac os x
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-18 12:05:09 +02:00
Felix Fietkau
e386259632
libubox: make uloop_fd::flags generic
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-18 12:05:09 +02:00
Felix Fietkau
cd5238b500
uloop: fix edge trigger handling on mac os x
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-18 11:02:20 +02:00
Felix Fietkau
ae40b66130
uloop: rework event processing, fix use-after-free issues
...
Recursive calls to uloop_run() need to process already fetched events
first, before running kqueue/epoll to get more.
The state of cur_fd/cur_nfds and the event list needs to be maintained
properly to prevent accidental running of events pointing at deleted
uloop_fd structs.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-11 12:55:21 +02:00
Felix Fietkau
e5032709b2
utils: add bitfield inline ops
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-10 13:37:14 +02:00
Felix Fietkau
2851ce7edb
ustream: only report stream eof once via state_change callback
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-31 11:18:26 +02:00
Felix Fietkau
70e7c09bcb
ustream: only report a write error once via state_change callback
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-31 11:17:02 +02:00
Felix Fietkau
54a0b49326
blobmsg_json: add blobmsg_add_json_from_file
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-29 12:14:48 +02:00
Felix Fietkau
c4b79e4b54
runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:27:45 +02:00
Felix Fietkau
92fdad5448
runqueue: fix include path
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:15:05 +02:00
Felix Fietkau
cb6c1718e7
runqueue: add a simple task queueing/completion tracking implementation
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:10:00 +02:00
Felix Fietkau
3ceb819690
ustream-example: fix container_of type errors
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:06:55 +02:00
Helmut Schaa
ecee1a3bea
libubox: Allow to build against libjson-c > 0.9
...
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2013-05-07 15:53:36 +02:00
Felix Fietkau
dcf93f3322
safe_list: add safe_list_empty()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-04-15 15:53:57 +02:00
Felix Fietkau
ee3e7a6f9f
safe_list: fix typo
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-04-15 15:39:09 +02:00
Felix Fietkau
009b4d574e
list.h: implement type safety for container_of()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-18 05:55:00 +01:00
Felix Fietkau
cdb9f71971
avl: fix type handling in container_of uses
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-18 05:53:44 +01:00
Felix Fietkau
7c11f6e913
safe_list: add a new linked list variant
...
Use this linked list implementation as a replacement for list.h if you
want to allow deleting arbitrary list entries from within one or more
recursive iterator calling context
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-18 05:47:53 +01:00
Felix Fietkau
00a833c5b6
jshn: add support for the double datatype
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-17 00:50:03 +01:00
Thomas Gstädtner
49e6e062b8
add pkgconfig support for json-c
...
this includes a fallback for legacy support
2013-03-05 10:44:48 +01:00
Felix Fietkau
b2010c706c
json_script: do not rely on global includes for other libubox header files
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-03-02 16:21:11 +01:00
Felix Fietkau
38ea521911
add json_script, a minimalistic JSON based script interpreter
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-28 21:50:55 +01: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
bd47d85d38
utils: make le16 endian conversion functions work with arguments that have side effects
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-14 23:39:57 +01:00
Felix Fietkau
fcd5ba8fbd
utils.h: make 16-bit little endian conversion robust against pointer subtraction arguments
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-14 22:02:56 +01:00
Felix Fietkau
d01922625d
utils: add little-endian swap helpers
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-13 12:35:19 +01:00
Felix Fietkau
e5a40544ec
utils: prefer using gccs builtin swapping functions which support constant folding
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-11 22:08:07 +01:00
Felix Fietkau
5ad190fccf
utils: move endian swap helpers and __packed definition to utils.h
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-11 21:46:41 +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
b786f85267
blob: add blob_buf_grow()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 20:43:33 +01:00
Felix Fietkau
9a3519536b
blobmsg_json: prefer to link against libjson-c over libjson (the new library name in git versions of json-c)
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 15:32:45 +01:00
Felix Fietkau
95fde87029
ustream: another fix for ustream_read_buf_full() with split read buffers
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-31 18:10:52 +01:00
Felix Fietkau
f83b6548c7
ustream-fd: do not loop back into the callback from ustream_fd_set_uloop
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-31 17:08:40 +01:00