libusual.git
10 years agoregex: simplify op_count_full error check master
Marko Kreen [Tue, 30 Dec 2014 13:18:52 +0000 (15:18 +0200)]
regex: simplify op_count_full error check

There was dummy loop with size limit for "performace" reasons,
but it triggered automatic checkers.  Remove complexity
by using strchr() there.

Reported-By: David Binderman
10 years agostring: use memset_s for explicit_bzero
Marko Kreen [Sun, 7 Sep 2014 20:14:18 +0000 (23:14 +0300)]
string: use memset_s for explicit_bzero

10 years agochacha: make faster
Marko Kreen [Mon, 1 Sep 2014 19:59:04 +0000 (22:59 +0300)]
chacha: make faster

10 years agocsrandom, keccak_prng, chacha: new modules
Marko Kreen [Wed, 9 Jul 2014 18:40:45 +0000 (21:40 +0300)]
csrandom, keccak_prng, chacha: new modules

csrandom implements arc4random_buf api.

keccak_prng implements PRNG based on Keccak sponge.

chacha implements ChaCha hash.

10 years agopthread: non-working once wrapper
Marko Kreen [Fri, 29 Aug 2014 09:58:18 +0000 (12:58 +0300)]
pthread: non-working once wrapper

10 years agowin32 cleanups
Marko Kreen [Fri, 29 Aug 2014 09:58:04 +0000 (12:58 +0300)]
win32 cleanups

10 years agohashing: memhash
Marko Kreen [Fri, 11 Jul 2014 22:09:51 +0000 (01:09 +0300)]
hashing: memhash

Fast in-memory hash, with randomized value.

10 years agoendian: WORDS_UNALIGNED_ACCESS_OK (draft)
Marko Kreen [Wed, 9 Jul 2014 17:03:55 +0000 (20:03 +0300)]
endian: WORDS_UNALIGNED_ACCESS_OK (draft)

Seems it might be useful (mainly inside endian.h) for non-gcc/clang
compilers, but needs proof.

10 years agomsvc: fail on non-x86, instead miscompiling
Marko Kreen [Wed, 9 Jul 2014 17:02:28 +0000 (20:02 +0300)]
msvc: fail on non-x86, instead miscompiling

10 years agostring: explicit_bzero
Marko Kreen [Fri, 11 Jul 2014 21:30:59 +0000 (00:30 +0300)]
string: explicit_bzero

10 years agostring: locale-independent float handling
Marko Kreen [Wed, 25 Jun 2014 22:59:12 +0000 (01:59 +0300)]
string: locale-independent float handling

10 years agostring: memstring functions
Marko Kreen [Sun, 22 Jun 2014 14:37:49 +0000 (17:37 +0300)]
string: memstring functions

10 years agoshlist: convert to offsets relateive to node itself
Marko Kreen [Sat, 21 Jun 2014 18:56:33 +0000 (21:56 +0300)]
shlist: convert to offsets relateive to node itself

Simplifies api and makes it more similar to list.h
as list head does not need to be carried around.

10 years agoshlist: fix empty check
Marko Kreen [Sat, 21 Jun 2014 09:35:53 +0000 (12:35 +0300)]
shlist: fix empty check

10 years agotest_cxalloc: fix printf warning
Marko Kreen [Fri, 20 Jun 2014 21:13:24 +0000 (00:13 +0300)]
test_cxalloc: fix printf warning

10 years agotest/compile: disable unused func warning
Marko Kreen [Fri, 20 Jun 2014 21:11:42 +0000 (00:11 +0300)]
test/compile: disable unused func warning

10 years agobits,endian: stop depending on libc
Marko Kreen [Fri, 20 Jun 2014 20:19:49 +0000 (23:19 +0300)]
bits,endian: stop depending on libc

Instead try to get compiler involved.

endian: add host-endian enc/dec functions.

10 years agobase: support magic clang macros, cleanups
Marko Kreen [Fri, 20 Jun 2014 20:18:53 +0000 (23:18 +0300)]
base: support magic clang macros, cleanups

10 years agodox: fix file locations
Marko Kreen [Sat, 14 Jun 2014 17:29:04 +0000 (20:29 +0300)]
dox: fix file locations

10 years agomake: tags
Marko Kreen [Thu, 19 Jun 2014 21:26:28 +0000 (00:26 +0300)]
make: tags

10 years agocbtree: allow long keys
Marko Kreen [Thu, 19 Jun 2014 21:26:59 +0000 (00:26 +0300)]
cbtree: allow long keys

10 years agocbtree: disallow double keys
Marko Kreen [Thu, 19 Jun 2014 21:32:22 +0000 (00:32 +0300)]
cbtree: disallow double keys

10 years agocxextra: custom alignment for pool
Marko Kreen [Mon, 16 Jun 2014 14:22:13 +0000 (17:22 +0300)]
cxextra: custom alignment for pool

10 years agotest_cfparser: allow run from top dir
Marko Kreen [Sun, 15 Jun 2014 10:49:48 +0000 (13:49 +0300)]
test_cfparser: allow run from top dir

10 years agoutf8: validator
Marko Kreen [Sat, 14 Jun 2014 21:25:46 +0000 (00:25 +0300)]
utf8: validator

For sanity-checking UTF8 without decoding.

10 years agousual.m4: INSTALL - use absolute path
Marko Kreen [Thu, 12 Jun 2014 18:53:47 +0000 (21:53 +0300)]
usual.m4: INSTALL - use absolute path

10 years agoRemove use of USUAL_ALLOC
Marko Kreen [Thu, 12 Jun 2014 18:50:47 +0000 (21:50 +0300)]
Remove use of USUAL_ALLOC

10 years agocxalloc: make cx=NULL mean USUAL_ALLOC
Marko Kreen [Tue, 27 May 2014 22:05:58 +0000 (01:05 +0300)]
cxalloc: make cx=NULL mean USUAL_ALLOC

10 years agobits: multiply with overflow check
Marko Kreen [Tue, 27 May 2014 16:03:41 +0000 (19:03 +0300)]
bits: multiply with overflow check

10 years agocxextra: pool improvements
Marko Kreen [Sat, 24 May 2014 17:09:42 +0000 (20:09 +0300)]
cxextra: pool improvements

10 years agocxextra/pool: initial size, realloc
Marko Kreen [Wed, 17 Apr 2013 15:37:11 +0000 (18:37 +0300)]
cxextra/pool: initial size, realloc

make reallow work always properly, although not efficiently.

10 years agosocket: getpeercreds cleanups
Marko Kreen [Wed, 17 Apr 2013 15:38:11 +0000 (18:38 +0300)]
socket: getpeercreds cleanups

10 years agokeccak: Sync with new SHA3 draft.
Marko Kreen [Fri, 23 May 2014 09:56:38 +0000 (12:56 +0300)]
keccak: Sync with new SHA3 draft.

- Sync SHA3 parameters and regtests with new FIPS202 draft.
- Move regular hash api to 'usual/crypto/sha3' module.
- Drop regular hash api from keccak module, use exteded
  sponge API used in spongeshaker Python module.

10 years agomk: refresh libusual2.temo
Marko Kreen [Sat, 3 May 2014 10:42:55 +0000 (13:42 +0300)]
mk: refresh libusual2.temo

10 years agocfparser: %include directive
Marko Kreen [Sat, 3 May 2014 10:06:21 +0000 (13:06 +0300)]
cfparser: %include directive

This includes body of other file into current one.

Based on patch by Andrew Dunstan.

11 years agoheap: heap_destroy() works on NULL argument
Marko Kreen [Wed, 30 Apr 2014 16:30:32 +0000 (19:30 +0300)]
heap: heap_destroy() works on NULL argument

11 years agousual/slab: sanitize object size and align.
Marko Kreen [Sun, 7 Jul 2013 13:32:28 +0000 (16:32 +0300)]
usual/slab: sanitize object size and align.

Too small values for both would make the code crash,
still allow them but replace with working values.

Noticed-by: Yue Du
12 years agoantimake: sync with antimake repo
Marko Kreen [Thu, 25 Apr 2013 21:59:12 +0000 (00:59 +0300)]
antimake: sync with antimake repo

- amext-msvc.mk: add description
- amext-cxx.mk: move c++ support to extension
- sync tests

12 years agomakefile: make config.h installable again
Marko Kreen [Thu, 25 Apr 2013 22:19:22 +0000 (01:19 +0300)]
makefile: make config.h installable again

12 years agocfparser: require that first section must be present
Marko Kreen [Tue, 2 Apr 2013 20:04:55 +0000 (23:04 +0300)]
cfparser: require that first section must be present

otherwise, when run on empty file, the main section defaults
are not filled in and program may crash.

12 years agosocket: getpeercreds() - getpeereid() + pid
Marko Kreen [Tue, 2 Apr 2013 20:01:09 +0000 (23:01 +0300)]
socket: getpeercreds() - getpeereid() + pid

Most OSes have also way to get pid of unix socket peer.

Provide generic API for fetching it.

Make compat getpeereid() wrap it, so all compat goo
is in one place.

12 years agoantimake: follow symlinks when searching extensions
Marko Kreen [Tue, 2 Apr 2013 19:19:50 +0000 (22:19 +0300)]
antimake: follow symlinks when searching extensions

12 years agom4/usual: fix ctype removal
Marko Kreen [Sun, 6 Jan 2013 20:06:00 +0000 (22:06 +0200)]
m4/usual: fix ctype removal

12 years agoamext-msvc: random cleanups
Marko Kreen [Sun, 6 Jan 2013 20:03:12 +0000 (22:03 +0200)]
amext-msvc: random cleanups

12 years agoantimake: safer test result print
Marko Kreen [Sun, 6 Jan 2013 20:02:24 +0000 (22:02 +0200)]
antimake: safer test result print

12 years agoantimake: keep per-object mkdir always quiet
Marko Kreen [Sun, 6 Jan 2013 19:21:15 +0000 (21:21 +0200)]
antimake: keep per-object mkdir always quiet

12 years agobase_win32: missing win32 includes
Marko Kreen [Sun, 6 Jan 2013 19:20:09 +0000 (21:20 +0200)]
base_win32: missing win32 includes

12 years agomsvc cleanup
Marko Kreen [Sun, 6 Jan 2013 11:58:47 +0000 (13:58 +0200)]
msvc cleanup

12 years agoantimake: use printf instead of echo
Marko Kreen [Sun, 6 Jan 2013 11:58:32 +0000 (13:58 +0200)]
antimake: use printf instead of echo

12 years agoantimake: dont use readpath when loading extensions
Marko Kreen [Sun, 6 Jan 2013 11:57:24 +0000 (13:57 +0200)]
antimake: dont use readpath when loading extensions

Seems it's not reliable.

12 years agomsvc fixes
Marko Kreen [Sun, 6 Jan 2013 10:52:30 +0000 (12:52 +0200)]
msvc fixes

12 years agoantimake: mkdir is not needed in ar_lib
Marko Kreen [Sun, 6 Jan 2013 10:52:10 +0000 (12:52 +0200)]
antimake: mkdir is not needed in ar_lib

12 years agoctype: always activate macros
Marko Kreen [Sun, 6 Jan 2013 11:53:44 +0000 (13:53 +0200)]
ctype: always activate macros

autoconf check is pointless, because compiler
can still complain about wrong usage.

So activate wrappers always, also remove arg,
so they are also used where function pointers are needed.

12 years agoamext-msvc: cleaups, safer mkdir
Marko Kreen [Sun, 6 Jan 2013 10:49:17 +0000 (12:49 +0200)]
amext-msvc: cleaups, safer mkdir

12 years agowchar: compat mbsnrtowcs(), tests
Marko Kreen [Sun, 6 Jan 2013 10:48:38 +0000 (12:48 +0200)]
wchar: compat mbsnrtowcs(), tests

12 years agotest: clean fmod_test
Marko Kreen [Sat, 5 Jan 2013 23:09:06 +0000 (01:09 +0200)]
test: clean fmod_test

12 years agotest/Makefile: cleanup
Marko Kreen [Sat, 5 Jan 2013 23:04:25 +0000 (01:04 +0200)]
test/Makefile: cleanup

* regtest_compat is now EXTRA target
* regtest_system is built against libusual.a

12 years agoantimake: make sure DEPENDENCIES and nodist_SOURCES exist before build starts.
Marko Kreen [Sat, 5 Jan 2013 23:03:16 +0000 (01:03 +0200)]
antimake: make sure DEPENDENCIES and nodist_SOURCES exist before build starts.

Old way tied them to final link, which is too late.

12 years agoantimake: clean also EXTRA targets
Marko Kreen [Sat, 5 Jan 2013 22:33:08 +0000 (00:33 +0200)]
antimake: clean also EXTRA targets

12 years agoantimake: call hooks also for EXTRA targets
Marko Kreen [Sat, 5 Jan 2013 22:29:29 +0000 (00:29 +0200)]
antimake: call hooks also for EXTRA targets

12 years agoantimake: don't clean LDADD/LIBADD files
Marko Kreen [Sat, 5 Jan 2013 22:06:04 +0000 (00:06 +0200)]
antimake: don't clean LDADD/LIBADD files

12 years agoMSVC support
Marko Kreen [Sat, 5 Jan 2013 19:04:11 +0000 (21:04 +0200)]
MSVC support

* Antimake extension 'msvc'
* Hardcoded config <usual/config.msvc.h>
* More guarded headers

Usage:
1. Install coreutils and make from gnuwin32
2. Make sure VC env variables are loaded (PATH)
3. Copy build_msvc.mk to build.mk

It would be nice to make it work with MSYS/MINGW32 + VC,
but their filename mangling makes it messy.

12 years agoctype: provide isblank() if missing
Marko Kreen [Sat, 5 Jan 2013 21:50:40 +0000 (23:50 +0200)]
ctype: provide isblank() if missing

12 years agobase_win32: type specifiers from inttypes.h
Marko Kreen [Sat, 5 Jan 2013 21:40:22 +0000 (23:40 +0200)]
base_win32: type specifiers from inttypes.h

12 years agotests: remove headers already included by base.h
Marko Kreen [Sat, 5 Jan 2013 21:24:36 +0000 (23:24 +0200)]
tests: remove headers already included by base.h

12 years agoantimake: support LIBDIR
Marko Kreen [Sat, 5 Jan 2013 16:51:51 +0000 (18:51 +0200)]
antimake: support LIBDIR

Now different extension can be used for static libraries.

12 years agoDrop Setup.mk
Marko Kreen [Sat, 5 Jan 2013 18:45:30 +0000 (20:45 +0200)]
Drop Setup.mk

There are better ways to use libusual now.

12 years agoSync test output with current 'make install'
Marko Kreen [Sat, 5 Jan 2013 18:40:51 +0000 (20:40 +0200)]
Sync test output with current 'make install'

12 years agomake install: handle subdirs properly
Marko Kreen [Sat, 5 Jan 2013 18:28:35 +0000 (20:28 +0200)]
make install: handle subdirs properly

12 years agoantimake temos: sync with crc module move
Marko Kreen [Sat, 5 Jan 2013 18:20:05 +0000 (20:20 +0200)]
antimake temos: sync with crc module move

12 years agoantimake: make OBJEXT include '.'
Marko Kreen [Sat, 5 Jan 2013 16:00:59 +0000 (18:00 +0200)]
antimake: make OBJEXT include '.'

Now the usage is same as EXEEXT.

12 years agoantimake: convert mkdir and printf to functions.
Marko Kreen [Sat, 5 Jan 2013 15:56:22 +0000 (17:56 +0200)]
antimake: convert mkdir and printf to functions.

Then it's possible to examine and change arguments.

12 years agoAvoid libtool, build simple static library
Marko Kreen [Thu, 14 Jun 2012 06:16:36 +0000 (09:16 +0300)]
Avoid libtool, build simple static library

12 years agocfparser,cxalloc: avoid use of struct field specifiers.
Marko Kreen [Wed, 13 Jun 2012 22:36:33 +0000 (01:36 +0300)]
cfparser,cxalloc: avoid use of struct field specifiers.

Seems msvc does not support them..

12 years agologging: Use __VA_ARGS__ for vararg macros
Marko Kreen [Wed, 13 Jun 2012 22:33:43 +0000 (01:33 +0300)]
logging: Use __VA_ARGS__ for vararg macros

It's more portable (msvc), seems the (args... + ## args) style
is GNU extension.

12 years agoantimake: show mkdir commands if in verbose mode
Marko Kreen [Sat, 16 Jun 2012 12:27:30 +0000 (15:27 +0300)]
antimake: show mkdir commands if in verbose mode

12 years agoantimake: use JoinPath when calculating feat file name
Marko Kreen [Sat, 16 Jun 2012 12:26:44 +0000 (15:26 +0300)]
antimake: use JoinPath when calculating feat file name

12 years agowchar: allow missing mbsnrtowcs()
Marko Kreen [Fri, 4 Jan 2013 23:05:48 +0000 (01:05 +0200)]
wchar: allow missing mbsnrtowcs()

12 years agopthread: missing HAVE_PTHREAD_H check
Marko Kreen [Fri, 4 Jan 2013 22:53:20 +0000 (00:53 +0200)]
pthread: missing HAVE_PTHREAD_H check

12 years agoRemove remaining C++ comments from source tree.
Marko Kreen [Fri, 4 Jan 2013 21:19:34 +0000 (23:19 +0200)]
Remove remaining C++ comments from source tree.

I like to use them for debugging, to show that this
comment is temporary, but that also means they
should not stay around.

12 years agofind_modules: test with various awks
Marko Kreen [Fri, 4 Jan 2013 07:51:05 +0000 (09:51 +0200)]
find_modules: test with various awks

12 years agofind_modules: older awks might not have 'in'
Marko Kreen [Fri, 4 Jan 2013 07:50:21 +0000 (09:50 +0200)]
find_modules: older awks might not have 'in'

12 years agodlfcn: new module for dlopen compat functions
Marko Kreen [Wed, 13 Jun 2012 22:29:54 +0000 (01:29 +0300)]
dlfcn: new module for dlopen compat functions

12 years agocf_set_time_usec: Use explicit cast for float->int conversion
Marko Kreen [Wed, 13 Jun 2012 22:21:22 +0000 (01:21 +0300)]
cf_set_time_usec: Use explicit cast for float->int conversion

12 years agotest/compile: fix daemonize() argument type
Marko Kreen [Wed, 13 Jun 2012 22:17:43 +0000 (01:17 +0300)]
test/compile: fix daemonize() argument type

12 years agoMerge pull request #4 from fdr/c89-comments
Marko Kreen [Thu, 3 Jan 2013 22:34:12 +0000 (14:34 -0800)]
Merge pull request #4 from fdr/c89-comments

Use C89 compatible comments

12 years agousual/fnmatch: fnmatch compat
Marko Kreen [Sat, 29 Dec 2012 17:21:13 +0000 (19:21 +0200)]
usual/fnmatch: fnmatch compat

12 years agousual/wchar: wide-char utilities.
Marko Kreen [Mon, 31 Dec 2012 12:18:49 +0000 (14:18 +0200)]
usual/wchar: wide-char utilities.

12 years agousual/hashing/siphash: SipHash-2-4
Marko Kreen [Sat, 29 Dec 2012 16:37:52 +0000 (18:37 +0200)]
usual/hashing/siphash: SipHash-2-4

New secure hash.

12 years agoMove simple hashes under separate subdirectory.
Marko Kreen [Sat, 22 Dec 2012 22:47:44 +0000 (00:47 +0200)]
Move simple hashes under separate subdirectory.

There may be more of them.

12 years agofind_module: avoid big regex
Marko Kreen [Sun, 23 Dec 2012 10:05:34 +0000 (12:05 +0200)]
find_module: avoid big regex

12 years agocrypto: Add Keccak (SHA3) algorithm
Marko Kreen [Mon, 29 Oct 2012 17:14:40 +0000 (19:14 +0200)]
crypto: Add Keccak (SHA3) algorithm

It is based on Keccak reference implementation, but cleaned
up for SHA3-only usage.

12 years agocrypto: SHA2 digests
Marko Kreen [Mon, 29 Oct 2012 16:13:46 +0000 (18:13 +0200)]
crypto: SHA2 digests

Separate module for both SHA-256 and SHA-512.

12 years agocrypto/digest: common framework for digests
Marko Kreen [Mon, 29 Oct 2012 06:33:35 +0000 (08:33 +0200)]
crypto/digest: common framework for digests

The digests will be easier to use (and test) if they share
common wrapper API.

12 years agocrypto: reorder arguments in _final()
Marko Kreen [Sun, 28 Oct 2012 21:48:18 +0000 (23:48 +0200)]
crypto: reorder arguments in _final()

The old one was final(dst, ctx) which is some sort of historical
accident.  Lets get rid of it.  Then all operations on hash context
take context as first argument.

12 years agoMove crypto files
Marko Kreen [Sun, 28 Oct 2012 21:04:35 +0000 (23:04 +0200)]
Move crypto files

There will be more, so give them subdirectory.

12 years agofind_modules: work with subdirs
Marko Kreen [Sun, 28 Oct 2012 21:30:01 +0000 (23:30 +0200)]
find_modules: work with subdirs

12 years agomakefile: asm and size tagets
Marko Kreen [Tue, 30 Oct 2012 20:48:17 +0000 (22:48 +0200)]
makefile: asm and size tagets

12 years agotest_regex: skip test that glibc fails
Marko Kreen [Tue, 30 Oct 2012 20:47:55 +0000 (22:47 +0200)]
test_regex: skip test that glibc fails

12 years agotest_endian: fix uint64 check
Marko Kreen [Tue, 30 Oct 2012 20:13:33 +0000 (22:13 +0200)]
test_endian: fix uint64 check