ewolfok
22bbcfddd7
blob: improve out-of-memory handling
...
Signed-off-by: Chen Bin <ewolfok@126.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-26 03:50:50 +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
Jo-Philipp Wich
bd388d2b6c
jshn: do not collapse whitespace in json_load()
...
When running the test case below the $key variable holds "foo bar" instead
of the expected "foo bar".
-- 8< --
. /usr/share/libubox/jshn.sh
json_init
json_load '{ "key": "foo bar" }'
json_get_var key key
-- >8 --
Quote the output of the "jshn -r" backtick expression to prevent the shell
from erroneously collapsing whitespace.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-07-16 20:36:13 +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
Felix Fietkau
fd5b522ce6
blobmsg-example: use blobmsg_get_string()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03 13:50:49 +02:00
Luka Perkov
b538c2b20e
examples: fix build error
...
Patch fixes the following error:
error: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Werror=format=]
indent_printf(indent, "%s\n", blobmsg_data(data));
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 13:48:30 +02:00
Felix Fietkau
8cee1e552a
blobmsg_example: fix output
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03 12:56:40 +02:00
Luka Perkov
db8e7060e0
examples: use PRIu64 instead %lld when printing uint64_t values
...
Patch fixes build failure:
error: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
indent_printf(indent, "%lld\n", *(uint64_t *)data);
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
480b6c7da1
examples: add missing include
...
Patch fixes following build error:
error: implicit declaration of function ‘close’ [-Werror=implicit-function-declaration]
close(cl->s.fd.fd);
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
fd3a33b7ed
examples: fix linking with json-c
...
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
b10cd1c0f6
examples: remove set but unused variable
...
Fixes build failure.
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Luka Perkov
531570aa51
usock: fix indentation
...
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03 12:53:13 +02:00
Xiongfei Guo
39a8fae441
Fix bug of GC in fd and timeout objects for lua binding.
...
fd and timeout lua object has a __gc method in its metatable. After the object
is freed and the another new object use the same reference in __uloop_cb and
__uloop_fds, the new object will be freed by the old __gc of the old object
when garbag collecting.
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
3c92274bee
Fix bug of unref resources in Lua binding; fd method delete -> cancel.
...
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
02ca593347
Support delete a fd event.
...
When you call the fd_add, it will return an object with `delete` method.
So you can delete that event if you want.
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
79b56268b4
Added fd_add method for uloop lua binding.
...
Use uloop.fd_add like this:
local socket = require "socket"
udp = socket.udp()
uloop.fd_add(
udp, -- socket
function( -- callback function
ufd, -- socket object when register the fd
events -- uloop events. eg. uloop.ULOOP_READ .
)
local words, msg_or_ip, port_or_nil = ufd:receivefrom()
print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words)
end,
uloop.ULOOP_READ -- event you want to listen
)
The `examples/uloop-example.lua` show an example of this work.
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
9565bf86ae
Fix stack overflow bug of uloop lua binding.
...
The static variable `state` in `lua/uloop.c` should be clean after every callback.
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
John Crispin
e130b08d98
build a static version of libubox
...
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-06-11 01:39:12 +01:00
Felix Fietkau
949f0d00bf
vlist: add static initializer macros
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-05 15:28:45 +02:00
Felix Fietkau
411d10c845
blobmsg_json: use cross-platform macro for fprintf on 64-bit values
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-31 14:48:03 +02:00
Felix Fietkau
1344d20ec0
json_script: fix a segfault in the file free handler
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-26 15:53:29 +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
Luka Perkov
f32a53f92b
uloop: fix multiple calls to uloop_run()
...
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-05-05 11:24:07 +02:00
Felix Fietkau
9203927e58
utils: add a bitfield size macro
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-30 13:27:03 +02:00
Felix Fietkau
31b3893a72
kvlist: constify arguments
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-28 17:56:08 +02:00
Felix Fietkau
d416bf6655
json_script: add json_script_run_file()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-28 17:54:25 +02:00
Felix Fietkau
178fe974af
json_script: implement json_script_eval_string
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-28 16:57:28 +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
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