Commit Graph

40 Commits

Author SHA1 Message Date
Matthew Brush f3f439998d
Merge pull request #5 from diogogithub/cfulist_set_free_function
Added cfulist_set_free_fn()
2018-06-08 16:12:51 -07:00
Diogo Cordeiro ff7404a58a cfulist_delete_data_with_free_fn was updated because of cfulist_set_free_function()
Now the doc explains better what happens with (if) a free function was previously set.
2018-06-08 19:48:02 +01:00
Diogo Cordeiro 483ef917df Merge remote-tracking branch 'upstream/master' into cfulist_set_free_function
This merge was necessary because cfulist_delete_data_with_free_fn
is directly related with the free_fn functionality.
2018-06-08 19:44:48 +01:00
Matthew Brush c599777b70
Merge pull request #4 from diogogithub/dev
Add cfulist_delete_data
2018-06-08 10:43:28 -07:00
Diogo Cordeiro c25e9cee24 Conditionals tests in cfulist_delete_data_with_free_fn() were simplified 2018-06-08 13:57:08 +01:00
Diogo Cordeiro 703622e03d Fix cfulist_destroy_with_free_fn() doc.
It was declared again as cfulist_destroy() and didn't mention the effects related to cfulist_set_free_function().
2018-06-08 13:46:11 +01:00
Diogo Cordeiro 4f4439828f Added cfulist_set_free_fn()
In analogy with cfuhash_set_free_fn()
2018-06-08 12:52:10 +01:00
Diogo Cordeiro 9d8fbcf53d There is no cfulist_set_free_function 2018-06-08 11:52:35 +01:00
Diogo Cordeiro 4d6a4c0a16 Add cfulist_delete_data_with_free_fn
Conditionals tests in cfulist_delete_data(_with_free_fn) were simplified
2018-06-08 11:43:15 +01:00
Diogo Cordeiro 00f09172c3 Fix cfulist_delete_data bugs
1. This function was not updating the list size
2. The first item was not being properly removed
3. Renamed some variables in order to make them more meaningful
2018-06-08 09:46:54 +01:00
Diogo Cordeiro d4528b8334 Fixed typo on cfulist_delete_data documentation
The return type should be in curly brackets
2018-06-07 23:38:48 +01:00
Diogo Cordeiro 5af4f108dc cfulist_delete_data now works for the first item
This function would crash for the first item.
Now it calls cfulist_dequeue to remove the first element when necessary.
2018-06-07 22:48:07 +01:00
Diogo Cordeiro b4faaca915 Add cfulist_delete_data
It is important to let the programmer remove a node from the linked list, as it is a very common operation.
2018-05-22 16:16:15 +01:00
Matthew Brush 1294791f0c Replace non-standard 'u_int32_t' with 'unsigned int'
Rather than standard uint32_t from stdint.h since it's C99.
Also adjust configure.ac to provide a uint64_t if one isn't available
for use in ctimer.c.
2013-03-07 12:33:57 -08:00
Matthew Brush 838479689d Fixup a few stricter warnings 2013-03-04 20:41:46 -08:00
Matthew Brush 23f8df7618 Remove old cfutime code 2013-03-04 20:17:23 -08:00
Matthew Brush 9926984543 Remove redundant use of extern storage class specifier 2013-03-04 20:10:32 -08:00
Matthew Brush b1db0ad1ee Properly declare parameterless functions as such
Also use void in the definitions for consistency.
2013-03-04 19:56:12 -08:00
Matthew Brush b82a8f4ec6 Add cfutimer which uses more accurate functions if available
This is some code I had previously written, adapted to (mostly)
libcfu coding style. The API is very similar to that of the
existing (to be eventually removed) cfutime.
2013-03-04 19:45:24 -08:00
Matthew Brush d35b0f5b20 Remove a bunch of superfluous casts
They just ugly up the code and could potentially hide errors.

The only problem it might cause is if using C++ compiler and,
well, don't do that. This is C code, use the right compiler :)
2013-03-04 17:59:44 -08:00
Matthew Brush a054a4de71 Make C89 compatible using some preprocessor trickery
Also using C99-snprintf file from:
  http://www.jhweiss.de/software/snprintf.html

For when in strict C89 compiler mode or when snprintf() or vsnprintf()
aren't for whatever reason available.

Use CFU_INLINE macro defined in cfu.h to make a decent attempt at
getting inline function support when in C89 mode.
2013-03-04 17:37:24 -08:00
Matthew Brush 0d7d3bf9c8 Make valid C99 and cleanup warnings using stricter flags
Flags used for these changes:
  -Wall -Wextra -Werror -Wno-unused-parameter -std=c99 -pedantic

Note: the strcasecmp()/strncasecmp() implementations are kind of
a hack and should at least be factored out into a compat file or
some such.
2013-03-04 17:04:33 -08:00
Matthew Brush da501075ce Remove leading _ from header inclusion guards
Identifiers starting with underscore followed by uppercase letter
are reserved identifiers (ex. C99 7.1.3).
2013-03-04 16:08:41 -08:00
Matthew Brush eed54b197b Remove unnecessary forward struct declarations 2013-03-04 16:06:12 -08:00
Matthew Brush aafe48ae0d Remove some unused preprocessor defines 2013-03-04 16:00:36 -08:00
Matthew Brush 01d2b274b7 Reformat and normalize licenses and headerss
This commit is purely aestetic/taste, nothing important.

I don't really like this *huge* license at the top of every file
but I guess it must stay so add it to some files where it wasn't
included so they are the same. Slightly reformat them.

Unindent extra indentation found in some headers.

Strip trailing whitespace in files and enabled setting in
editor, which caused a lot of noise in this commit but that should
be the end of it.

Remove the comment at the top of each file that said who created
it and when (it will remain in VCS history for reference and was
always Don who created the files).
2013-03-04 15:48:27 -08:00
Matthew Brush eb89c4bf8e Use Libtool to enable building shared library 2013-03-04 15:22:09 -08:00
Matthew Brush 382bac9900 Replace libcfu-config utility with a pkg-config .pc file 2013-03-04 15:10:02 -08:00
Matthew Brush 8b89377762 Remove final? use of u_int so it builds on OSX 2013-03-04 03:44:29 -08:00
Matthew Brush dd8b293d22 Fixup header inclusion and C++ guards a bit
* Now headers only include headers they use (at least std headers).
* Remove CFU_DEBUG stuff since NDEBUG automatically controls assert()
* Make use of CFU_BEGIN_DECLS and CFU_END_DECLS macros from cfu.h.
2013-03-04 03:18:47 -08:00
Matthew Brush ec404e96a9 Make POSIX threads library optional
Guard out use of pthreads in hash and list and don't build the
thread queue when pthreads is not available.
2013-03-04 03:04:27 -08:00
Matthew Brush 5b2f19e1c4 Fix some wrong formatting characters for size_t
The '%lu' isn't stricly right either, but now this commit can be
referred to find locations to fix with the more correct '%zu' or
'PRIuMAX' or whatever is the right thing to use.
2013-03-04 02:46:04 -08:00
Matthew Brush 2aed767bb7 Re-write examples/Makefile.am a bit
This gets the examples compiling again.
2013-03-04 02:35:09 -08:00
Matthew Brush 3cfc07997b Cleanup src/Makefile.am a bit 2013-03-04 02:31:22 -08:00
Matthew Brush aed8b7f4da Move headers from include dir to src dir 2013-03-04 02:22:28 -08:00
Matthew Brush 5b15c782d0 Remove cfutypes.h(.in) since it seems to be useless
Also make cfu.h not generated. Need to fix the @VERSION@ replacement
it was using in a future commit, for now it's just hardcoded.
2013-03-04 02:19:05 -08:00
Matthew Brush 49862e7b8d Re-write configure.ac a bit 2013-03-04 02:11:33 -08:00
Matthew Brush 1a19591a67 Start fixing up the build system 2013-03-04 01:57:54 -08:00
Matthew Brush bd619f4226 Cleanup built files from initial commit
Add myself to AUTHORS.
There might still be generated files in the doc dir but I don't
know enough about that setup yet to start deleting files.
2013-03-04 01:46:56 -08:00
Matthew Brush f660e3460a Initial commit
All of the files from the tarball downloaded from SourceForge are
being checked in so there's a record of the changes made compared
to it (since I can't find the libcfu source repository). The
generated files will be removed in the following commit.
2013-03-04 01:40:58 -08:00