Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-01-21utils: use clock_get_time() for clock_gettime() on Apple.Yousong Zhou
It turns out that mach_absolute_time() is not monotonic at all. While at it, convert the CLOCK_REALTIME implementation to using clock_get_time() as well. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-21uloop: optimize uloop_timeout_set() implementaiton a bit.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-21ustream-fd: fix logic invert of write polling.Yousong Zhou
ustream_write_pending() returns true if write buffer was flushed there. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-21ustream: add function ustream_read().Yousong Zhou
It can be used to fill caller-specified buffer with data already in ustream read buffer. Useful in the following use pattern. int available = ustream_pending_data(s, false); if (available >= sizeof(struct msghdr)) { struct msghdr h; ustream_read(s, &h, sizeof(h)); } Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-15usock: set socket flags right after creating itRafał Miłecki
Otherwise some flags like USOCK_NONBLOCK wouldn't work as expected (O_NONBLOCK affects connect behavior). Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
2015-01-15usock: add helper waiting for socket to be readyRafał Miłecki
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
2014-12-22examples: add example code for json_script.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-22json_script: fix logic invert of handle_expr_not().Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11json_script: remove unneed argument check before calling ↵Yousong Zhou
__json_script_file_free(). NULL check is present at the begining of function body. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11json_script: fix eval_string().Yousong Zhou
- Fix handling of "%%". - Fix length requirement when calling blobmsg_realloc_string_buffer(). Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11jshn: add error handling and fix memory leak in jshn_format().Yousong Zhou
Though currently jshn is more a one-shot data transformation tool and won't leak much memory in its lifetime, people may use it as example code, so do it right. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11blobmsg: remove unneeded assignment in blobmsg_alloc_string_buffer().Yousong Zhou
data_dest should already be assigned by blobmsg_new() if the return value is not NULL. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11examples: fix build.Yousong Zhou
- runqueue-example.c: fix include path for in-tree build. - blobmsg-example.c: add inttypes.h for using PRIu64. - add examples/ subdirectory to main CMakeLists.txt Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11lua: do not hardcode /opt/local/include for Apple.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11libubox: drop legacy json-c supportYousong Zhou
The cmake logic is wrong (E.G. PKG_CHECK_FOR_MODULES fails unless all modules are found), and the legacy libjson.so name is also used by the other libjson (http://sourceforge.net/projects/libjson/) which provides an incompatible API, so just drop it. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-11-24Revert "jshn: only keep UP_* variables around while they are needed"Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: shorten JSON_VAR to J_VFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: shorten variable names to speed up processingFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: remove TYPE_JSON_VARFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: do not export JSON_SEQFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: only keep UP_* variables around while they are neededFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-11-23jshn: improve performance by using let instead of $(( ))Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-24blobmsg_json: avoid redefinition of json_objectFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-10-12uloop: Do not override signal handlers not installed by usMichel Stam
Signed-off-by: Michel Stam <m.stam@fugro.nl>
2014-10-12uloop: Remove uloop_cancelled variable, it is not used anywhereMichel Stam
Signed-off-by: Michel Stam <m.stam@fugro.nl>
2014-10-01md5: add a new implementation under permissive licenseFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-23blobmsg_json: include json.h inside blobmsg_json.c instead of the public ↵Felix Fietkau
header file Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-23avoid using the deprecated is_error() function from json-cFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-23usock: add usock_port() for convenient use of numeric portsJo-Philipp Wich
Add a new helper function usock_port() which converts the given numeric port number into a string using a private static buffer. This way a calling application can conveniently use numeric port arguments without having to convert them before: int fd = usock(USOCK_UDP, "example.org", usock_port(80)); Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-08-04jshn: pretty print indented output with jshn -i -wJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-08-03blobmsg: accept NULL attr in blobmsg_get_string()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-27lua/uloop: 'end' is the keyword of Lua, use 'cancel' replace it.xfguo@credosemi.com
Signed-off-by: Xiongfei Guo <xfguo@credosemi.com>
2014-07-26blob: improve out-of-memory handlingewolfok
Signed-off-by: Chen Bin <ewolfok@126.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-21blobmsg: add a helper function to reset the name of a blobmsg attributeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-16jshn: do not collapse whitespace in json_load()Jo-Philipp Wich
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-15blobmsg: add blobmsg_check_array, which returns the size of the arrayFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03blobmsg-example: use blobmsg_get_string()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03examples: fix build errorLuka Perkov
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-03blobmsg_example: fix outputFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03examples: use PRIu64 instead %lld when printing uint64_t valuesLuka Perkov
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-03examples: add missing includeLuka Perkov
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-03examples: fix linking with json-cLuka Perkov
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03examples: remove set but unused variableLuka Perkov
Fixes build failure. Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03usock: fix indentationLuka Perkov
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-06-24Fix bug of GC in fd and timeout objects for lua binding.Xiongfei Guo
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-24Fix bug of unref resources in Lua binding; fd method delete -> cancel.Xiongfei Guo
Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24Support delete a fd event.Xiongfei Guo
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-24Added fd_add method for uloop lua binding.Xiongfei Guo
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-24Fix stack overflow bug of uloop lua binding.Xiongfei Guo
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-11build a static version of libuboxJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>