Commit graph

274 commits

Author SHA1 Message Date
Felix Fietkau
aa01be8ed0 blob: make length variables unsigned
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-27 16:29:31 +02:00
Bastian Bittorf
51766c25e9 sh/jshn.sh - json_cleanup() dont pollute env with local vars
this script is mostly sourced, so we should try to keep the pollution
of the users environment as low as possible. make the var 'tmp' local

Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com>
2014-04-26 21:30:33 +02:00
Felix Fietkau
73a88451dd uloop: clear uloop_fd::error on add
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-26 16:55:17 +02:00
Felix Fietkau
131b3352d9 blobmsg_json: let blobmsg_format_json_with_cb with list == true also format arrays
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-26 10:59:00 +02:00
Felix Fietkau
ef918710c0 blob: fix handling of custom validator callback
https://dev.openwrt.org/ticket/15638

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-21 12:02:32 +02:00
Felix Fietkau
c4b9eb1442 kvlist: avoid unused-but-set warnings in code not using the name in kvlist_for_each()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-15 16:58:55 +02:00
Felix Fietkau
b3a6939f38 md5: remove unnecessary variable change
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:25:32 +02:00
Felix Fietkau
31b2d244fd blobmsg_json: fix a memleak on error
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:23:23 +02:00
Felix Fietkau
c725f9f7a5 ustream: remove unnecessary initialization
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:21:13 +02:00
Felix Fietkau
93a4cb92c1 blobmsg: remove unnecessary initialization
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:20:36 +02:00
Felix Fietkau
d4b56b0940 kvlist: add a simply key/value store implementation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 01:42:44 +02:00
Felix Fietkau
f59f33f2c7 avl: add AVL_TREE macro to define an initialized struct avl_tree
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-27 17:39:53 +01:00
Felix Fietkau
93b415c08d list_compat.h: remove
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 23:06:42 +01:00
Felix Fietkau
97ec6311f2 list_compat.h: remove list_remove()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 23:00:53 +01:00
Felix Fietkau
f5e105b603 list_compat.h: remove list_add_before()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 23:00:24 +01:00
Felix Fietkau
7673f2ab47 list_compat.h: remove list_add_after()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 22:59:26 +01:00
Felix Fietkau
fdcf117ff3 list_compat.h: remove list_add_head()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 22:58:21 +01:00
Felix Fietkau
d1e59653fa list_compat.h: remove list_init_head()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 22:56:45 +01:00
Felix Fietkau
bbdfee8182 list_compat.h: remove list_entity compat define
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 22:55:45 +01:00
Felix Fietkau
3edc29942c avl.c: remove compat macros and switch to the argument order from list.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20 22:54:59 +01:00
Felix Fietkau
4f44401ae8 utils: add __constructor and __hidden defines
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-18 14:04:06 +01:00
Felix Fietkau
c78b684104 blobmsg_json: unconditionally use blobmsg data/len accessor functions
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-12 20:18:12 +01: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
Karl Vogel
926121113b uloop: Add flag to allow callback to be called on error conditions.
In some conditions, an application is interested in errors happening
on a file descriptor and might be able to resolve the issue in the
callback function.

This patch adds a flag to notify the uloop framework that errors
should be passed to the callback function, instead of silently
removing the fd from the polling set.

Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
2014-02-23 18:18:32 +01:00
Felix Fietkau
43d2d349cb jshn: drop json_select warnings when called from json_get_values()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-02 15:22:23 +01:00
Helmut Schaa
bbd846ec2d libubox: runqueue: Cancel task timeout when completeing task
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2014-01-29 03:32:30 +00:00
Jo-Philipp Wich
e58fa88e1f jshn: add ability to pass default values to json_get_var and json_get_vars 2013-12-10 17:30:15 +00:00
Felix Fietkau
318d682d29 jshn: in json_get_values(), handle json_select errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-12-02 10:56:54 +01:00
Felix Fietkau
9636c0e79c jshn: optimize the shell code some more
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-12-01 22:06:16 +01:00
Jo-Philipp Wich
f6827c7c93 blobmsg_json: do not emit any whitespace when formatting without indentation 2013-11-27 18:56:04 +00:00
John Crispin
f100acef37 fix memset call in md5.c
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-11-19 22:53:18 +01:00
John Crispin
e8b26ce48d add md5.c to libubox
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-11-19 20:31:45 +01:00
John Crispin
bc8167eb99 runqueue: add a function that allows adding jobs to the front of the runqueue
Signed-off-by: John Crispin <blogic@openwrt.org>
2013-11-18 12:25:21 +01:00
Felix Fietkau
a34c8f6918 jshn: refactor _jshn_append to require fewer evals
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-30 11:50:39 +01:00
Felix Fietkau
dcbc14a701 jshn: improve performance by getting rid of unnecessary variables in parser related code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-30 11:36:46 +01:00
Felix Fietkau
2d4ce122c4 jshn: do not export SEQ_*
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-30 10:58:34 +01:00
Felix Fietkau
1a32939cb5 jshn: get rid of the table stack, use the UP_* variable instead to speed up processing
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-30 10:58:34 +01:00
Felix Fietkau
554ed49c15 jshn: reduce the number of appends to the cleanup list to speed up processing of large json files
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-30 10:57:51 +01:00
Felix Fietkau
b7e61837e7 jshn: allow json_get_keys/values to refer to the currently selected array/table if no argument is given
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 15:11:42 +01:00
Felix Fietkau
b5aa522f5d jshn: add json_get_values (useful for arrays)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-29 14:59:47 +01:00
Felix Fietkau
a2453456f2 utils.h: fix name collisions in __u_bswap16 with using "val" both inside the macro and as argument
Reported-by: Markus Stenberg <markus.stenberg@iki.fi>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-24 11:33:23 +02:00
Kristian Evensen
13a9b7c709 Restore signal handler after uloop_run()
uloop_run calls uloop_setup_signals() to set up signal handling before the while
loop, but does not remove the signal handling after the loop has ended. This can
cause problems for for example applications using the ubus file descriptor in
their own event loops, and perhaps with their own signal handling.

This patch stores the signal handle that was in place when the initial
uloop_run() call was made, and restores the handle when this call returns.
For recursive calls, the signal handler is not updated.

One use-case I experienced was an application that subscribed to several ubus
objects and used the ubus file descriptor in its own event loop. Even though
ubus_register_subscriber() (which calls uloop_run()) had returned, the signal
handler was not removed. This caused SIGINT not to be caught by the application.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-22 17:26:05 +02: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
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