oweals/libubox.git
11 years agoutils: add BUILD_BUG_ON (similar to the one in the linux kernel)
Felix Fietkau [Tue, 1 Jan 2013 15:10:27 +0000 (16:10 +0100)]
utils: add BUILD_BUG_ON (similar to the one in the linux kernel)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: add ustream_pending_data accessor function
Felix Fietkau [Tue, 1 Jan 2013 15:10:14 +0000 (16:10 +0100)]
ustream: add ustream_pending_data accessor function

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: make it unnecessary to specify the last NULL argument for calloc_a
Felix Fietkau [Mon, 31 Dec 2012 14:40:07 +0000 (15:40 +0100)]
utils: make it unnecessary to specify the last NULL argument for calloc_a

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoutils: move ARRAY_SIZE from uloop to utils.h
Felix Fietkau [Mon, 31 Dec 2012 14:02:31 +0000 (15:02 +0100)]
utils: move ARRAY_SIZE from uloop to utils.h

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoadd utils.c, containing a calloc-like function to allocate multiple chunks with diffe...
Felix Fietkau [Sun, 30 Dec 2012 21:42:46 +0000 (22:42 +0100)]
add utils.c, containing a calloc-like function to allocate multiple chunks with different sizes in one block and return pointers

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: avoid calling s->poll from a write path to avoid looping back through the...
Felix Fietkau [Sun, 30 Dec 2012 18:21:03 +0000 (19:21 +0100)]
ustream: avoid calling s->poll from a write path to avoid looping back through the notify_write cb

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: fix polling for write buffer availability after buffering writes
Felix Fietkau [Sun, 30 Dec 2012 16:26:40 +0000 (17:26 +0100)]
ustream: fix polling for write buffer availability after buffering writes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: suppress write attempts in ustream_printf and ustream_vprintf if a write...
Felix Fietkau [Sun, 30 Dec 2012 14:46:18 +0000 (15:46 +0100)]
ustream: suppress write attempts in ustream_printf and ustream_vprintf if a write error was flagged

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoustream: add ustream_read_buf_full() helper
Felix Fietkau [Sun, 30 Dec 2012 14:25:35 +0000 (15:25 +0100)]
ustream: add ustream_read_buf_full() helper

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: fix check to reset array sequence counters on cleanup
Felix Fietkau [Tue, 18 Dec 2012 12:38:27 +0000 (13:38 +0100)]
jshn: fix check to reset array sequence counters on cleanup

11 years agojshn: introduce json_is_a() convenience function to check field types without using...
Jo-Philipp Wich [Mon, 17 Dec 2012 12:54:45 +0000 (13:54 +0100)]
jshn: introduce json_is_a() convenience function to check field types without using a temporary variable

11 years agojshn: fix array handling
Felix Fietkau [Sun, 16 Dec 2012 18:58:06 +0000 (19:58 +0100)]
jshn: fix array handling

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: fix some variable handling regressions
Felix Fietkau [Sun, 16 Dec 2012 17:04:14 +0000 (18:04 +0100)]
jshn: fix some variable handling regressions

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agojshn: add support for namespaces
Felix Fietkau [Sun, 16 Dec 2012 16:46:02 +0000 (17:46 +0100)]
jshn: add support for namespaces

Can be used to fix variable namespace clashes in library code using jshn

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
11 years agoblob.h: fix endian check
Felix Fietkau [Sun, 2 Dec 2012 16:49:08 +0000 (17:49 +0100)]
blob.h: fix endian check

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 years agouloop: fix tv_diff() calculation
Felix Fietkau [Wed, 31 Oct 2012 19:28:11 +0000 (20:28 +0100)]
uloop: fix tv_diff() calculation

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 years agouloop: another timer fix
Felix Fietkau [Wed, 31 Oct 2012 19:09:47 +0000 (20:09 +0100)]
uloop: another timer fix

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 years agouloop: fix sub-second timer offsets for uloop_timeout_set
Felix Fietkau [Wed, 31 Oct 2012 19:03:45 +0000 (20:03 +0100)]
uloop: fix sub-second timer offsets for uloop_timeout_set

12 years agoustream: make notify_state optional as well
Felix Fietkau [Mon, 29 Oct 2012 23:00:57 +0000 (00:00 +0100)]
ustream: make notify_state optional as well

12 years agoustream: mark notify_read cb as optional
Felix Fietkau [Mon, 29 Oct 2012 23:00:23 +0000 (00:00 +0100)]
ustream: mark notify_read cb as optional

12 years agoustream: add a poll callback function defined by the ustream implementation
Felix Fietkau [Mon, 29 Oct 2012 22:39:48 +0000 (23:39 +0100)]
ustream: add a poll callback function defined by the ustream implementation

12 years agoustream: fix variable initialization
Felix Fietkau [Mon, 29 Oct 2012 22:11:08 +0000 (23:11 +0100)]
ustream: fix variable initialization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 years agoustream-example: fix logic inversion
Felix Fietkau [Tue, 23 Oct 2012 16:00:18 +0000 (18:00 +0200)]
ustream-example: fix logic inversion

12 years agouloop: fix a segfault on deleting the first active timer from within another timer
Felix Fietkau [Tue, 23 Oct 2012 01:41:45 +0000 (03:41 +0200)]
uloop: fix a segfault on deleting the first active timer from within another timer

12 years agoustream: add a pointer to the ustream struct useful for chaining ustreams
Felix Fietkau [Mon, 22 Oct 2012 20:28:43 +0000 (22:28 +0200)]
ustream: add a pointer to the ustream struct useful for chaining ustreams

12 years agoustream.h: include stdarg.h
Felix Fietkau [Mon, 22 Oct 2012 19:14:02 +0000 (21:14 +0200)]
ustream.h: include stdarg.h

12 years agoadd -Wmissing-declarations to cflags
Felix Fietkau [Mon, 22 Oct 2012 18:03:53 +0000 (20:03 +0200)]
add -Wmissing-declarations to cflags

12 years agoadd declarations for lua{open,close}_uloop to avoid warnings
Felix Fietkau [Mon, 22 Oct 2012 18:03:33 +0000 (20:03 +0200)]
add declarations for lua{open,close}_uloop to avoid warnings

12 years agoustream: make ustream_init_buf static
Felix Fietkau [Mon, 22 Oct 2012 18:02:38 +0000 (20:02 +0200)]
ustream: make ustream_init_buf static

12 years agoadd a cmake file for the examples and add the binaries to .gitignore
Felix Fietkau [Sun, 21 Oct 2012 21:01:30 +0000 (23:01 +0200)]
add a cmake file for the examples and add the binaries to .gitignore

12 years agoustream: add example code
Felix Fietkau [Sun, 21 Oct 2012 21:01:12 +0000 (23:01 +0200)]
ustream: add example code

12 years agoadd ustream, an api for stream buffer management
Felix Fietkau [Sun, 21 Oct 2012 21:00:06 +0000 (23:00 +0200)]
add ustream, an api for stream buffer management

12 years agoblobmsg-example: fix compile errors
Felix Fietkau [Sun, 21 Oct 2012 01:40:53 +0000 (03:40 +0200)]
blobmsg-example: fix compile errors

12 years agouloop: fix event delete races on mac os x
Felix Fietkau [Sun, 21 Oct 2012 01:40:35 +0000 (03:40 +0200)]
uloop: fix event delete races on mac os x

12 years agolist.h: undefine LIST_HEAD to prevent conflicts on mac os x
Felix Fietkau [Thu, 4 Oct 2012 14:11:04 +0000 (16:11 +0200)]
list.h: undefine LIST_HEAD to prevent conflicts on mac os x

12 years agolua: use relative paths for includes instead of system-wide
Felix Fietkau [Thu, 4 Oct 2012 12:14:52 +0000 (14:14 +0200)]
lua: use relative paths for includes instead of system-wide

12 years agorename proc_cb to ul_process_cb
John Crispin [Fri, 28 Sep 2012 23:11:31 +0000 (01:11 +0200)]
rename proc_cb to ul_process_cb

Signed-off-by: John Crispin <blogic@openwrt.org>
12 years agoadd an example script for the uloop lua binding
Felix Fietkau [Thu, 27 Sep 2012 11:47:46 +0000 (13:47 +0200)]
add an example script for the uloop lua binding

12 years agoadd lua binding for uloop (written by John Crispin)
Felix Fietkau [Thu, 27 Sep 2012 11:30:33 +0000 (13:30 +0200)]
add lua binding for uloop (written by John Crispin)

12 years agouloop: clear processes and timeouts on uloop_done()
Felix Fietkau [Sun, 8 Jul 2012 20:27:40 +0000 (22:27 +0200)]
uloop: clear processes and timeouts on uloop_done()

12 years agouloop: handle EPOLLHUP like EPOLLERR to prevent infinite tight loops between epoll_wa...
Jo-Philipp Wich [Sat, 7 Jul 2012 16:17:40 +0000 (18:17 +0200)]
uloop: handle EPOLLHUP like EPOLLERR to prevent infinite tight loops between epoll_wait() and the continue in uloop_run_events()

12 years agoblobmsg: remove the unnecessary name argument from blobmsg_check_attr_list, infer...
Felix Fietkau [Sun, 24 Jun 2012 19:11:06 +0000 (21:11 +0200)]
blobmsg: remove the unnecessary name argument from blobmsg_check_attr_list, infer it from the list type

12 years agoblobmsg: add blobmsg_check_attr_list() to validate element types of arrays and tables
Felix Fietkau [Sun, 24 Jun 2012 19:07:47 +0000 (21:07 +0200)]
blobmsg: add blobmsg_check_attr_list() to validate element types of arrays and tables

12 years agouloop: prevent fd callbacks for unregistered fds by ensuring that pointers in the...
Felix Fietkau [Sun, 24 Jun 2012 19:06:16 +0000 (21:06 +0200)]
uloop: prevent fd callbacks for unregistered fds by ensuring that pointers in the epoll array are cleared

12 years agovlist.h: protect against multiple inclusions
Felix Fietkau [Sun, 10 Jun 2012 15:11:36 +0000 (17:11 +0200)]
vlist.h: protect against multiple inclusions

12 years agoblob: add blob_memdup()
Felix Fietkau [Fri, 1 Jun 2012 18:54:05 +0000 (20:54 +0200)]
blob: add blob_memdup()

12 years agosh/jshn.sh: fix json_get_var() and json_get_type() to not return cached values
Jo-Philipp Wich [Wed, 30 May 2012 19:47:43 +0000 (21:47 +0200)]
sh/jshn.sh: fix json_get_var() and json_get_type() to not return cached values

12 years agoMerge branch 'master' of nbd.name:luci2/libubox
Jo-Philipp Wich [Tue, 29 May 2012 00:17:35 +0000 (02:17 +0200)]
Merge branch 'master' of nbd.name:luci2/libubox

12 years agosh/jshn.sh: replace "tr" calls with inline substitution, signalize success with retur...
Jo-Philipp Wich [Tue, 29 May 2012 00:10:20 +0000 (02:10 +0200)]
sh/jshn.sh: replace "tr" calls with inline substitution, signalize success with return values

12 years agosh/jshn.sh: replace "tr" calls with inline substitution, signalize success with retur...
Jo-Philipp Wich [Tue, 29 May 2012 00:06:39 +0000 (02:06 +0200)]
sh/jshn.sh: replace "tr" calls with inline substitution, signalize success with return values

12 years agouloop: include sys/types.h to make pid_t available
Benjamin Larsson [Mon, 28 May 2012 12:59:49 +0000 (14:59 +0200)]
uloop: include sys/types.h to make pid_t available

12 years agoremove uapi.h, afacis nothing uses it
Felix Fietkau [Sat, 26 May 2012 16:04:34 +0000 (18:04 +0200)]
remove uapi.h, afacis nothing uses it

12 years agoswitch blobmsg_json over to permissive license
Felix Fietkau [Sat, 26 May 2012 16:03:08 +0000 (18:03 +0200)]
switch blobmsg_json over to permissive license

12 years agoswitch blobmsg over to permissive license
Felix Fietkau [Sat, 26 May 2012 16:02:30 +0000 (18:02 +0200)]
switch blobmsg over to permissive license

12 years agoremove ulog.h, afaics nothing uses it
Felix Fietkau [Sat, 26 May 2012 15:59:59 +0000 (17:59 +0200)]
remove ulog.h, afaics nothing uses it

12 years agoadd vlist (from netifd)
Felix Fietkau [Sat, 26 May 2012 15:57:04 +0000 (17:57 +0200)]
add vlist (from netifd)

12 years agoadd avl_strcmp
Felix Fietkau [Sat, 26 May 2012 15:50:10 +0000 (17:50 +0200)]
add avl_strcmp

12 years agosh/jshn.sh: fix allowing numbers in identifiers
Felix Fietkau [Thu, 17 May 2012 12:29:59 +0000 (14:29 +0200)]
sh/jshn.sh: fix allowing numbers in identifiers

json_add_generic() needs to handle them as well

12 years agosh/jshn.sh: allow numbers in identifiers for json_get_var()
Jo-Philipp Wich [Tue, 15 May 2012 22:18:16 +0000 (00:18 +0200)]
sh/jshn.sh: allow numbers in identifiers for json_get_var()

When traversing arrays of tables or arrays of array it is required to
call json_select # where # is the index of the array item to select.

Internally json_select() calls json_get_var() to obtain the correct
prefix to populate $JSON_CUR with. However, the "tr" call in
json_get_var() incorrectly replaces all digits with underscores,
making any lookup for numeric array items fail.

The attached patch changes the "tr" expression to allow digits and
thus implements the expected behaviour for nested arrays.

12 years agojshn.sh: add json_get_vars() wrapper function
Felix Fietkau [Sun, 13 May 2012 22:21:12 +0000 (00:21 +0200)]
jshn.sh: add json_get_vars() wrapper function

12 years agoadd blobmsg_add_blob() to copy over an existing blobmsg attribute
Felix Fietkau [Tue, 8 May 2012 13:59:19 +0000 (15:59 +0200)]
add blobmsg_add_blob() to copy over an existing blobmsg attribute

12 years agoremove uhtbl-test.c, it is obsolete
Felix Fietkau [Wed, 14 Mar 2012 10:55:59 +0000 (11:55 +0100)]
remove uhtbl-test.c, it is obsolete

12 years agoreplace list.h with a BSD licensed variant (taken from FreeBSD SVN)
Felix Fietkau [Mon, 6 Feb 2012 20:09:42 +0000 (21:09 +0100)]
replace list.h with a BSD licensed variant (taken from FreeBSD SVN)

13 years agoblobmsg: add missing endian conversions
Felix Fietkau [Wed, 16 Nov 2011 23:47:49 +0000 (00:47 +0100)]
blobmsg: add missing endian conversions

13 years agoblobmsg_json: print int16 elements in blobmsg_format_element (patch by Luka Perkov)
Felix Fietkau [Wed, 16 Nov 2011 23:40:37 +0000 (00:40 +0100)]
blobmsg_json: print int16 elements in blobmsg_format_element (patch by Luka Perkov)

13 years agoblob: switch to ISC license, switch blob_{get,put}_int* to _u*, add wrappers
Felix Fietkau [Thu, 10 Nov 2011 08:05:33 +0000 (09:05 +0100)]
blob: switch to ISC license, switch blob_{get,put}_int* to _u*, add wrappers

13 years agomake casts from void * explicit to avoid C++ warnings (patch by Arthur Davis)
Felix Fietkau [Thu, 27 Oct 2011 08:16:56 +0000 (10:16 +0200)]
make casts from void * explicit to avoid C++ warnings (patch by Arthur Davis)

13 years agolist.h: rename parameter named "new" to "_new" to avoid using a reserved C++ keyword...
Felix Fietkau [Thu, 27 Oct 2011 08:15:01 +0000 (10:15 +0200)]
list.h: rename parameter named "new" to "_new" to avoid using a reserved C++ keyword (patch by Arthur Davis)

13 years agofix more instances of uninitialized padding bytes
Felix Fietkau [Thu, 6 Oct 2011 15:57:13 +0000 (17:57 +0200)]
fix more instances of uninitialized padding bytes

13 years agoblobmsg: fill padding between name and data
Felix Fietkau [Thu, 6 Oct 2011 15:19:28 +0000 (17:19 +0200)]
blobmsg: fill padding between name and data

13 years agomake the blobmsg format endian agnostic (stick to big-endian)
Felix Fietkau [Thu, 6 Oct 2011 15:15:00 +0000 (17:15 +0200)]
make the blobmsg format endian agnostic (stick to big-endian)

13 years agofill padding bytes when setting raw attribute length
Felix Fietkau [Thu, 6 Oct 2011 15:14:44 +0000 (17:14 +0200)]
fill padding bytes when setting raw attribute length

13 years agoexplicitly zero extra buffer space added with realloc to silence valgrind warnings
Felix Fietkau [Mon, 3 Oct 2011 10:41:51 +0000 (12:41 +0200)]
explicitly zero extra buffer space added with realloc to silence valgrind warnings

13 years agofix reads beyond the end of the buffer when iterating over blob attributes
Felix Fietkau [Mon, 3 Oct 2011 10:36:46 +0000 (12:36 +0200)]
fix reads beyond the end of the buffer when iterating over blob attributes

13 years agoadd a blobmsg_type() inline function
Felix Fietkau [Mon, 12 Sep 2011 11:37:53 +0000 (13:37 +0200)]
add a blobmsg_type() inline function

13 years agosame for json_get_var
Felix Fietkau [Sun, 11 Sep 2011 09:46:44 +0000 (11:46 +0200)]
same for json_get_var

13 years agojshn: support using characters in elements that do not conform to shell variable...
Felix Fietkau [Sun, 11 Sep 2011 09:40:22 +0000 (11:40 +0200)]
jshn: support using characters in elements that do not conform to shell variable restrictions

13 years agoadd blobmsg_get_bool
Felix Fietkau [Wed, 7 Sep 2011 04:33:36 +0000 (06:33 +0200)]
add blobmsg_get_bool

13 years agoblob_attr_equal: un-inline, add pointer checks
Felix Fietkau [Mon, 5 Sep 2011 04:25:51 +0000 (06:25 +0200)]
blob_attr_equal: un-inline, add pointer checks

13 years agoadd blob_attr_equal() for comparing attributes
Felix Fietkau [Mon, 5 Sep 2011 04:09:32 +0000 (06:09 +0200)]
add blob_attr_equal() for comparing attributes

13 years agofix a bug in blobmsg_parse
Felix Fietkau [Wed, 17 Aug 2011 17:44:11 +0000 (10:44 -0700)]
fix a bug in blobmsg_parse

a second entry that has the same length as an existing found entry would
abort the parse loop (reported by Stefan Mächler)

13 years agochange the include path for list.h in jshn.c
Felix Fietkau [Fri, 12 Aug 2011 17:12:50 +0000 (11:12 -0600)]
change the include path for list.h in jshn.c

13 years agoadd a missing include
Felix Fietkau [Thu, 11 Aug 2011 21:37:48 +0000 (15:37 -0600)]
add a missing include

13 years agojshn: clear more variables on json_init, fix adding array elements
Felix Fietkau [Thu, 11 Aug 2011 21:29:23 +0000 (15:29 -0600)]
jshn: clear more variables on json_init, fix adding array elements

13 years agoadd blob_buf_free
Felix Fietkau [Fri, 29 Jul 2011 17:38:30 +0000 (19:38 +0200)]
add blob_buf_free

13 years agoadd BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8
Felix Fietkau [Fri, 29 Jul 2011 10:56:18 +0000 (12:56 +0200)]
add BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8

13 years agoblobmsg_json: support indenting of output data
Felix Fietkau [Mon, 18 Jul 2011 11:04:23 +0000 (13:04 +0200)]
blobmsg_json: support indenting of output data

13 years agojshn: add an option for printing the json data without a terminating newline
Felix Fietkau [Tue, 31 May 2011 13:41:19 +0000 (15:41 +0200)]
jshn: add an option for printing the json data without a terminating newline

13 years agouloop: use list.h, add support for handling sigchld
Felix Fietkau [Tue, 24 May 2011 19:46:10 +0000 (21:46 +0200)]
uloop: use list.h, add support for handling sigchld

13 years agojshn: fix invalid variable reuse
Felix Fietkau [Mon, 23 May 2011 21:15:33 +0000 (23:15 +0200)]
jshn: fix invalid variable reuse

13 years agojshn: do not use -n on export
Felix Fietkau [Mon, 23 May 2011 21:09:19 +0000 (23:09 +0200)]
jshn: do not use -n on export

13 years agoadd jshn
Felix Fietkau [Mon, 23 May 2011 20:21:27 +0000 (22:21 +0200)]
add jshn

13 years agomake the avl node key const
Felix Fietkau [Wed, 13 Apr 2011 18:14:20 +0000 (20:14 +0200)]
make the avl node key const

13 years agoremove int16, use int8 as bool instead of integer
Felix Fietkau [Sun, 27 Mar 2011 00:08:51 +0000 (01:08 +0100)]
remove int16, use int8 as bool instead of integer

13 years agosupport building without json support
Felix Fietkau [Sat, 26 Mar 2011 22:50:33 +0000 (23:50 +0100)]
support building without json support

13 years agoremove the hlist code
Felix Fietkau [Sat, 26 Mar 2011 19:38:33 +0000 (20:38 +0100)]
remove the hlist code

13 years agochange minimum cmake version to 2.6
Felix Fietkau [Sat, 12 Feb 2011 22:58:09 +0000 (23:58 +0100)]
change minimum cmake version to 2.6

13 years agouloop: fix event timeouts on darwin
Felix Fietkau [Sat, 12 Feb 2011 20:33:32 +0000 (21:33 +0100)]
uloop: fix event timeouts on darwin

13 years agouloop: allow timeouts to cancel the event loop
Felix Fietkau [Fri, 11 Feb 2011 01:38:32 +0000 (02:38 +0100)]
uloop: allow timeouts to cancel the event loop

13 years agoallow multiple calls to uloop_init() without annoying side effects
Felix Fietkau [Fri, 11 Feb 2011 00:25:17 +0000 (01:25 +0100)]
allow multiple calls to uloop_init() without annoying side effects