Scott James Remnant | 9489e8b | 2007-03-13 16:56:33 +0000 | [diff] [blame^] | 1 | 2007-03-13 Scott James Remnant <scott@netsplit.com> |
| 2 | |
| 3 | * nih/io.h: Change int_data type to a plain old int; there's no |
| 4 | reason for it to be a fixed width type, and we may as well think |
| 5 | about supporting ILP64 in case someone does something silly one day. |
| 6 | |
Scott James Remnant | 0c2a709 | 2007-03-11 12:56:21 +0000 | [diff] [blame] | 7 | 2007-03-11 Scott James Remnant <scott@netsplit.com> |
| 8 | |
Scott James Remnant | c2f2180 | 2007-03-11 18:57:40 +0000 | [diff] [blame] | 9 | * m4/compiler.m4: Don't check for __thread unless --enable-threading |
| 10 | given to configure, instead define it to empty. |
| 11 | |
Scott James Remnant | 0c2a709 | 2007-03-11 12:56:21 +0000 | [diff] [blame] | 12 | * TODO: Update. |
| 13 | |
Scott James Remnant | 674fbd5 | 2007-03-09 12:56:40 +0000 | [diff] [blame] | 14 | 2007-03-09 Scott James Remnant <scott@netsplit.com> |
| 15 | |
| 16 | * nih/logging.c: Make the current log priority available globally |
| 17 | through the nih_log_priority variable. |
| 18 | * nih/logging.h: Update. |
| 19 | |
Scott James Remnant | 44f3efb | 2007-03-08 12:07:16 +0000 | [diff] [blame] | 20 | 2007-03-08 Scott James Remnant <scott@netsplit.com> |
| 21 | |
| 22 | * nih/macros.h (_n): Add a macro to wrap ngettext() for plural forms. |
| 23 | |
Scott James Remnant | 5291158 | 2007-03-02 11:26:15 +0000 | [diff] [blame] | 24 | 2007-03-02 Scott James Remnant <scott@netsplit.com> |
| 25 | |
| 26 | * nih/tests/test_watch.c: Skip these tests if inotify is not |
| 27 | available, since there's not much we can do. |
| 28 | |
Scott James Remnant | 3820ef0 | 2007-02-16 16:15:18 +0000 | [diff] [blame] | 29 | 2007-02-16 Scott James Remnant <scott@netsplit.com> |
| 30 | |
Scott James Remnant | 7d72c6a | 2007-02-16 18:25:04 +0000 | [diff] [blame] | 31 | * nih/tree.c (nih_tree_next, nih_tree_prev): Add non-recursive |
| 32 | functions to iterate a tree in-order either forwards or backwards. |
| 33 | * nih/tree.h (NIH_TREE_FOREACH): Standard macro for wrapping |
| 34 | nih_tree_next and turning it into a for loop. |
| 35 | * nih/tests/test_tree.c (test_next, test_foreach, test_prev): Test |
| 36 | things with a complex tree to see whether they work out ok. |
| 37 | |
Scott James Remnant | b365aa9 | 2007-02-16 16:15:24 +0000 | [diff] [blame] | 38 | * nih/list.h: Fix formatting and ordering. |
| 39 | * nih/list.c: Fix function ordering. |
| 40 | |
Scott James Remnant | 3820ef0 | 2007-02-16 16:15:18 +0000 | [diff] [blame] | 41 | * nih/tree.c: Add generic code to implement pure binary trees. |
| 42 | * nih/tree.h: Structures, typedefs and prototypes. |
| 43 | * nih/tests/test_tree.c: Binary tree test suite. |
| 44 | * nih/libnih.h: Include tree.h |
| 45 | * nih/Makefile.am (libnih_la_SOURCES): Build and link tree.c |
| 46 | (nihinclude_HEADERS): Install tree.h |
| 47 | (TESTS): Build and run binary tree test suite. |
| 48 | (test_tree_SOURCES, test_tree_LDFLAGS, test_tree_LDADD): Details for |
| 49 | binary tree test suite binary. |
| 50 | |
Scott James Remnant | bcfe9c5 | 2007-02-15 17:02:00 +0000 | [diff] [blame] | 51 | 2007-02-15 Scott James Remnant <scott@netsplit.com> |
| 52 | |
| 53 | * nih/watch.c (INOTIFY_EVENTS): Use IN_CLOSE_WRITE instead of |
| 54 | IN_MODIFY; since that guarantees the file has actually been closed, |
| 55 | and is probably on the filesystem now. |
| 56 | |
Scott James Remnant | 7b820c9 | 2007-02-13 15:38:16 +0000 | [diff] [blame] | 57 | 2007-02-13 Scott James Remnant <scott@netsplit.com> |
| 58 | |
Scott James Remnant | 24a7f32 | 2007-02-13 18:00:04 +0000 | [diff] [blame] | 59 | * nih/signal.c: Add SIGUNUSED to the list of signals that might not |
| 60 | exist. |
| 61 | |
Scott James Remnant | 482c5f5 | 2007-02-13 15:42:53 +0000 | [diff] [blame] | 62 | * nih/tests/test_option.c (test_parser): gcc doesn't like using |
| 63 | variables inside fixed for loops, so initialise it deliberately. |
| 64 | * nih/tests/test_command.c (test_help): Was mistakenly repeatedly |
| 65 | opening output. |
| 66 | (test_parser): Similar for loop issue. |
| 67 | |
Scott James Remnant | 7b820c9 | 2007-02-13 15:38:16 +0000 | [diff] [blame] | 68 | * nih/signal.c: Update signal name list, some signals don't exist on |
| 69 | sparc and some turn up unexpectedly. |
| 70 | |
Johan Kiviniemi | 2b33612 | 2007-02-11 17:27:19 +0200 | [diff] [blame] | 71 | 2007-02-11 Johan Kiviniemi <johan@kiviniemi.name> |
| 72 | |
| 73 | * nih/hash.h (NIH_HASH_FOREACH, NIH_HASH_FOREACH_SAFE): Added missing |
Scott James Remnant | dbd6c3b | 2007-02-11 17:01:25 +0000 | [diff] [blame] | 74 | parenthesis around hash, in case it's a complicated expression with |
| 75 | unsurprising precedence results. |
Johan Kiviniemi | 2b33612 | 2007-02-11 17:27:19 +0200 | [diff] [blame] | 76 | |
Scott James Remnant | 005d6b3 | 2007-02-11 13:48:25 +0000 | [diff] [blame] | 77 | 2007-02-11 Scott James Remnant <scott@netsplit.com> |
| 78 | |
Scott James Remnant | c3c2cd9 | 2007-02-11 16:36:03 +0000 | [diff] [blame] | 79 | * nih/config.c (nih_config_skip_whitespace): It turns out that when |
| 80 | parsing, it's often useful to skip any whitespace while retaining the |
| 81 | "step over newlines" behaviour. Seperate it out into its own |
| 82 | function. |
| 83 | (nih_config_next_token): Call the new function. |
| 84 | * nih/config.h: Add prototype. |
| 85 | * nih/tests/test_config.c (test_skip_whitespace): Check the function |
| 86 | |
Scott James Remnant | 66869da | 2007-02-11 14:04:01 +0000 | [diff] [blame] | 87 | * nih/config.c: Remove macro definitions |
| 88 | * nih/config.h: and make them public instead |
| 89 | * nih/tests/test_config.c: Use macros. |
| 90 | |
Scott James Remnant | 7c91a1b | 2007-02-11 14:00:51 +0000 | [diff] [blame] | 91 | * nih/config.c (nih_config_next_token): Strange hybrid function, |
| 92 | it behaves like next_arg() but accepts the same arguments as token(); |
| 93 | it skips whitespace, but only if the initial whitespace character is |
| 94 | in the delim argument. |
| 95 | (nih_config_next_arg): This becomes a wrapper around next_token. |
| 96 | * nih/config.h: Add prototype. |
| 97 | * nih/tests/test_config.c (test_next_token): Check the new function. |
| 98 | |
Scott James Remnant | 005d6b3 | 2007-02-11 13:48:25 +0000 | [diff] [blame] | 99 | * nih/config.c (nih_config_next_token): Rename to nih_config_token, |
| 100 | since this doesn't behave like the next_arg() function, and we want |
| 101 | a similar token function that behaves like that. |
| 102 | * nih/config.h: Update. |
| 103 | * nih/tests/test_config.c (test_next_token): Rename and update. |
| 104 | |
Scott James Remnant | a65f90a | 2007-02-09 04:54:25 +0000 | [diff] [blame] | 105 | 2007-02-09 Scott James Remnant <scott@netsplit.com> |
| 106 | |
Scott James Remnant | 0b041a8 | 2007-02-09 17:30:41 +0000 | [diff] [blame] | 107 | * nih/hash.h (NIH_HASH_FOREACH_SAFE): Oops, s/list/hash/ |
| 108 | |
Scott James Remnant | 5838603 | 2007-02-09 17:02:20 +0000 | [diff] [blame] | 109 | * nih/hash.h (NIH_HASH_FOREACH, NIH_HASH_FOREACH_SAFE): Add macros |
| 110 | to iterate over an entire hash table. |
| 111 | * nih/tests/test_hash.c (test_foreach, test_foreach_safe): Test the |
| 112 | macros. |
| 113 | |
Scott James Remnant | d2ea67d | 2007-02-09 16:46:45 +0000 | [diff] [blame] | 114 | * nih/hash.c (nih_hash_string_key): Add a useful function to return |
| 115 | the first member after the list header. |
| 116 | * nih/hash.h: Add prototype. |
| 117 | * nih/tests/test_hash.c (test_string_key): Add test case. |
| 118 | |
Scott James Remnant | a65f90a | 2007-02-09 04:54:25 +0000 | [diff] [blame] | 119 | * nih/file.c (nih_file_is_packaging): Check for common packaging |
| 120 | filenames -- I swore I wrote this, but I can't find it. |
| 121 | (nih_file_ignore): Ignore packaging files. |
| 122 | * nih/file.h: Update. |
| 123 | * nih/tests/test_file.c (test_is_packaging, test_ignore): Test. |
| 124 | |
Scott James Remnant | 6538fed | 2007-02-07 02:12:14 +0000 | [diff] [blame] | 125 | 2007-02-07 Scott James Remnant <scott@netsplit.com> |
| 126 | |
| 127 | * nih/logging.c (nih_logger_printf): Change printf logger to not |
| 128 | prefix anything intended for stdout. |
| 129 | * nih/logging.h: Rearrange. |
| 130 | * nih/tests/test_logging.c (test_logger_printf): Make sure that |
| 131 | we don't prefix the program name for messages that go to stdout. |
| 132 | |
Scott James Remnant | 5467de2 | 2007-02-06 11:40:33 +0000 | [diff] [blame] | 133 | 2007-02-06 Scott James Remnant <scott@netsplit.com> |
| 134 | |
Scott James Remnant | 5ddca83 | 2007-02-06 23:39:10 +0000 | [diff] [blame] | 135 | * nih/signal.c (nih_signal_from_name): Table changed to not contain |
| 136 | SIG, so this now strips it off the front if present. |
| 137 | * nih/tests/test_signal.c (test_to_name): Strip SIG from the front |
| 138 | (test_from_name): Check that we can omit SIG from the front. |
| 139 | |
Scott James Remnant | a057437 | 2007-02-06 23:33:41 +0000 | [diff] [blame] | 140 | * nih/signal.c (nih_signal_to_name, nih_signal_from_name): Functions |
| 141 | annoyingly missing from the standard library; convert signal names |
| 142 | and numbers between each other (e.g. SIGTERM -> 15). |
| 143 | * nih/signal.h: Add prototypes. |
| 144 | * nih/tests/test_signal.c (test_to_name, test_from_name): Put the |
| 145 | new functions through their paces. |
| 146 | |
Scott James Remnant | c16ef2a | 2007-02-06 14:26:20 +0000 | [diff] [blame] | 147 | * nih/string.c (nih_str_array_add, nih_str_array_addn): Correct leak |
| 148 | when array allocation fails. |
| 149 | |
Scott James Remnant | c2c42f5 | 2007-02-06 13:14:24 +0000 | [diff] [blame] | 150 | * nih/string.c (nih_str_array_add, nih_str_array_addn) |
| 151 | (nih_str_array_addp): Allow the array pointed to to be NULL, after all, |
| 152 | realloc works anyway. Also allow len to be NULL, in which case, we |
| 153 | count the elements automatically. |
| 154 | * nih/tests/test_string.c (test_array_addp): Update test cases. |
| 155 | |
Scott James Remnant | eadc99e | 2007-02-06 12:44:12 +0000 | [diff] [blame] | 156 | * nih/config.c (nih_config_parse_args): Use nih_str_array functions. |
| 157 | * nih/file.c (nih_dir_walk_scan): Use nih_str_array functions. |
| 158 | * nih/option.c (nih_option_parser): Use nih_str_array functions. |
| 159 | (nih_option_add_arg): Drop this function now. |
| 160 | |
Scott James Remnant | f953c4e | 2007-02-06 12:28:58 +0000 | [diff] [blame] | 161 | * nih/string.c (nih_str_array_addp): Yet another variation on a theme; |
| 162 | this one saves duplicating allocs, which is always messy. |
| 163 | (nih_str_array_addn): Wrap around the above function. |
| 164 | (nih_str_array_add): Make this a wrapper around addp instead. |
| 165 | * nih/string.h: Update. |
| 166 | * nih/tests/test_string.c (test_array_addp): Check that one works. |
| 167 | |
Scott James Remnant | d55a13e | 2007-02-06 12:13:41 +0000 | [diff] [blame] | 168 | * nih/string.c (nih_str_split): Use nih_str_array functions. |
| 169 | |
Scott James Remnant | a839df5 | 2007-02-06 12:09:48 +0000 | [diff] [blame] | 170 | * nih/string.c (nih_str_array_addn): Add a version of nih_str_array_add |
| 171 | that calls nih_strndup instead of nih_strdup. |
| 172 | (nih_str_array_add): turn into a thin wrapper around the above. |
| 173 | * nih/string.h: Update. |
| 174 | * nih/tests/test_string.c (test_array_addn): Test new function. |
| 175 | |
Scott James Remnant | 7d2b90d | 2007-02-06 12:06:36 +0000 | [diff] [blame] | 176 | * nih/string.c (nih_str_array_add): Flip array and parent arguments |
| 177 | to make it more like realloc. |
| 178 | * nih/string.h: Update. |
| 179 | * nih/tests/test_string.c (test_array_add): Update. |
| 180 | |
Scott James Remnant | 3e7d905 | 2007-02-06 12:03:20 +0000 | [diff] [blame] | 181 | * nih/string.c (nih_str_array_new, nih_str_array_add): Functions |
| 182 | to handle the common cases of arrays of strings. |
| 183 | * nih/string.h: Update. |
| 184 | * nih/tests/test_string.c (test_array_new, test_array_add): Test. |
| 185 | |
Scott James Remnant | 5467de2 | 2007-02-06 11:40:33 +0000 | [diff] [blame] | 186 | * nih/watch.c (nih_watch_handle): Never assert on data received from |
| 187 | an untrusted source (well, the kernel, anyway). Also make sure nobody |
| 188 | sneaks a '/' into the name of an inotify event. |
| 189 | |
Scott James Remnant | 15fbe67 | 2007-02-05 22:13:28 +0000 | [diff] [blame] | 190 | 2007-02-05 Scott James Remnant <scott@netsplit.com> |
| 191 | |
| 192 | * nih/string.c (nih_vsprintf): Make sure vsnprintf never returns |
| 193 | a negative value; C99 says it can't, of course, but Kees was |
| 194 | paranoid. |
| 195 | |
Scott James Remnant | 0f9e01c | 2007-02-03 11:31:59 +0000 | [diff] [blame] | 196 | 2007-02-03 Scott James Remnant <scott@netsplit.com> |
| 197 | |
Scott James Remnant | 6dd4389 | 2007-02-03 23:42:26 +0000 | [diff] [blame] | 198 | * nih/watch.c (nih_watch_new): Tidy up ENOMEM loop. |
| 199 | |
Scott James Remnant | 9794397 | 2007-02-03 18:36:14 +0000 | [diff] [blame] | 200 | * nih/tests/test_file.c (test_dir_walk): Fix leak of directory caused |
| 201 | by not removing a symlink. |
| 202 | * nih/tests/test_watch.c (test_new, test_add): Fix leaks of |
| 203 | directories caused by not changing permissions back so we can unlink |
| 204 | under them. |
| 205 | |
Scott James Remnant | 8630d28 | 2007-02-03 17:24:11 +0000 | [diff] [blame] | 206 | * nih/watch.h (NihCreateHandler, NihModifyHandler): Add stat argument. |
| 207 | * nih/watch.c (nih_watch_handle): stat any object created or modified, |
| 208 | and pass the stat buf to the handler function. |
| 209 | (nih_watch_add_visitor): Pass stat argument here too. |
| 210 | |
| 211 | * nih/tests/test_watch.c: Add arguments. |
| 212 | |
Scott James Remnant | 28d252e | 2007-02-03 15:35:38 +0000 | [diff] [blame] | 213 | * nih/option.c (nih_option_int): Function to parse integer values |
| 214 | on the command line. |
| 215 | * nih/option.h: Add prototype. |
| 216 | * nih/tests/test_option.c (test_int): test case for it. |
| 217 | |
Scott James Remnant | 0f9e01c | 2007-02-03 11:31:59 +0000 | [diff] [blame] | 218 | * nih/file.c (nih_file_is_hidden, nih_file_is_backup) |
| 219 | (nih_file_is_swap, nih_file_is_rcs): Functions to match common |
| 220 | file types by their path. |
| 221 | (nih_file_ignore): Function to combine calls to all of the above. |
| 222 | * nih/file.h: Add prototypes. |
| 223 | * nih/tests/test_file.c: Add test cases for the new functions. |
| 224 | * TODO: Update. |
| 225 | |
Scott James Remnant | 98b9ddb | 2007-02-02 16:24:37 +0000 | [diff] [blame] | 226 | 2007-02-02 Scott James Remnant <scott@netsplit.com> |
| 227 | |
Scott James Remnant | bfe1c79 | 2007-02-02 19:34:09 +0000 | [diff] [blame] | 228 | * TODO: Update. |
| 229 | |
Scott James Remnant | 700ea52 | 2007-02-02 19:31:41 +0000 | [diff] [blame] | 230 | * nih/watch.c (nih_watch_new): Add a create argument to avoid |
| 231 | walking a directory tree twice; store in the structure. |
| 232 | (nih_watch_add_visitor): Call the create handler if necessary. |
| 233 | * nih/watch.h: Update structure to include member and prototype. |
| 234 | * nih/tests/test_watch.c (test_new): Check that, when called with |
| 235 | create, the handler is called for each file that exists. |
| 236 | (test_reader): Check that a directory is recursed when moved in |
| 237 | or created with existing files. |
| 238 | |
Scott James Remnant | 0b2a85f | 2007-02-02 17:29:40 +0000 | [diff] [blame] | 239 | * nih/tests/test_watch.c (test_reader): Add test case for watching |
| 240 | sub-directories again. |
| 241 | |
Scott James Remnant | 387453f | 2007-02-02 17:22:07 +0000 | [diff] [blame] | 242 | * nih/watch.c (nih_watch_new, nih_watch_add): Make safe against |
| 243 | ENOMEM; otherwise it's just tricky to decide when it's good and bad |
| 244 | to throw things out. |
| 245 | * nih/tests/test_watch.c: Update test cases accordingly. |
| 246 | |
Scott James Remnant | f88eeff | 2007-02-02 17:12:05 +0000 | [diff] [blame] | 247 | * nih/watch.c (nih_watch_add): It's not an error for subdirs to be |
| 248 | TRUE when we get passed a filename. |
| 249 | * nih/tests/test_watch.c (test_add): Check that it works. |
| 250 | |
Scott James Remnant | d1e8b40 | 2007-02-02 17:04:38 +0000 | [diff] [blame] | 251 | * nih/file.c (nih_dir_walk): Initialise ret to zero, otherwise |
| 252 | can return an uninitialised value when walking an empty directory. |
| 253 | |
Scott James Remnant | 9a37179 | 2007-02-02 17:01:43 +0000 | [diff] [blame] | 254 | * nih/tests/test_child.c (test_poll): Reap the child we kill, |
| 255 | otherwise the next test might fail sometimes. |
| 256 | |
Scott James Remnant | 80598b7 | 2007-02-02 16:58:49 +0000 | [diff] [blame] | 257 | * nih/watch.c (nih_watch_add): Make being unable to recurse into |
| 258 | sub-directories to watch them an error. |
| 259 | * nih/tests/test_watch.c (test_new, test_add): Update test cases. |
| 260 | |
Scott James Remnant | 98b9ddb | 2007-02-02 16:24:37 +0000 | [diff] [blame] | 261 | * nih/file.c (nih_dir_walk): Rework this function to support |
| 262 | detection of directory loops, and reporting of errors with a callback |
| 263 | handler rather than just aborting the walk. |
| 264 | (nih_dir_walk_scan): Build up a sorted list of paths under a directory, |
| 265 | filtered with the filter function. Split out because it has different |
| 266 | error handling semantics. |
| 267 | (nih_dir_walk_visit): Visit a single path and if it's a directory, |
| 268 | descend into it. |
| 269 | * nih/file.h (NihFileVisitor): Add arguments to pass the top-level |
| 270 | directory and the stat buffer of the path (to avoid stating the same |
| 271 | things multiple times). |
| 272 | (NihFileErrorHandler): Duplicate prototype for the error handler. |
| 273 | * nih/errors.h (NIH_DIR_LOOP_DETECTED): Add new error. |
| 274 | * nih/tests/test_file.c (test_dir_walk): Update test cases, improving |
| 275 | test coverage at the same time. |
| 276 | * nih/watch.c (nih_watch_add_visitor): Update to check the stat |
| 277 | passed to the visitor, as well as accept the directory name, |
| 278 | |
Scott James Remnant | e9a05d9 | 2007-02-01 17:21:06 +0000 | [diff] [blame] | 279 | 2007-02-01 Scott James Remnant <scott@netsplit.com> |
| 280 | |
Scott James Remnant | e0a1380 | 2007-02-01 17:24:25 +0000 | [diff] [blame] | 281 | * nih/tests/test_io.c: Replace NIH_ZERO in test cases with assert0 |
| 282 | |
Scott James Remnant | de33f51 | 2007-02-01 17:21:27 +0000 | [diff] [blame] | 283 | * nih/tests/test_main.c (test_main_loop): Eliminate use of NIH_MUST |
| 284 | * nih/tests/test_io.c (test_watcher): Remove unnecessary NIH_MUST |
| 285 | |
Scott James Remnant | e9a05d9 | 2007-02-01 17:21:06 +0000 | [diff] [blame] | 286 | * nih/test.h (assert0): Add an assert wrapper for the common |
| 287 | alternate case. |
| 288 | |
Scott James Remnant | 3e48360 | 2007-01-30 11:01:21 +0000 | [diff] [blame] | 289 | 2007-01-30 Scott James Remnant <scott@netsplit.com> |
| 290 | |
Scott James Remnant | 4535297 | 2007-01-30 12:17:59 +0000 | [diff] [blame] | 291 | * nih/io.c (nih_io_buffer_resize): Always keep a buffer filled with |
| 292 | zeros when we extend it, so we never pass uninitialised data to |
| 293 | syscalls. |
| 294 | |
Scott James Remnant | 0d1d420 | 2007-01-30 12:07:27 +0000 | [diff] [blame] | 295 | * m4/misc.m4 (NIH_INIT): Detect valgrind/valgrind.h |
| 296 | * nih/tests/test_signal.c: Detect valgrind and don't check the error |
| 297 | values from trying to set SIG_DFL or SIG_IGN for SIGKILL; which for |
| 298 | no readily apparent reason, works under valgrind. |
| 299 | |
Scott James Remnant | d78b814 | 2007-01-30 11:51:59 +0000 | [diff] [blame] | 300 | * HACKING: Add newline to end of file. |
| 301 | |
Scott James Remnant | 5db5426 | 2007-01-30 11:48:42 +0000 | [diff] [blame] | 302 | * nih/test.h (TEST_ALLOC_SAFE): Add macro to guard allocations so |
| 303 | they aren't counted. |
| 304 | * nih/tests/test_file.c (my_visitor, test_dir_walk): Use |
| 305 | TEST_ALLOC_SAFE instead of changing the allocator by hand. |
| 306 | * nih/tests/test_io.c (test_watcher): Use TEST_ALLOC_SAFE instead of |
| 307 | changing the allocator by hand, |
| 308 | |
Scott James Remnant | 3a11613 | 2007-01-30 11:41:19 +0000 | [diff] [blame] | 309 | * nih/macros.h (NIH_MUST_NOT): Rename to NIH_ZERO |
| 310 | * nih/io.c (nih_io_message_recv): Use NIH_ZERO, instead of == 0 |
| 311 | * nih/main.c (nih_main_loop_init): Use NIH_ZERO, instead of == 0 |
| 312 | * nih/tests/test_io.c: Use NIH_ZERO not NIH_MUST...== 0 |
| 313 | |
Scott James Remnant | 6939ebb | 2007-01-30 11:32:05 +0000 | [diff] [blame] | 314 | * nih/tests/test_io.c (test_watcher): Ensure that we don't ignore |
| 315 | the return value from nih_io_printf; but also don't fail it. |
| 316 | |
Scott James Remnant | 9753674 | 2007-01-30 11:29:44 +0000 | [diff] [blame] | 317 | * HACKING: Clarify that returning to indicate insufficient memory |
| 318 | warrants warn_unused_result. |
| 319 | |
Scott James Remnant | 08463f3 | 2007-01-30 11:28:21 +0000 | [diff] [blame] | 320 | * nih/io.h: Add warn_unused_result attribute to nih_io_printf. |
| 321 | * nih/string.c: Correct doc strings. |
| 322 | |
Scott James Remnant | 0d01e7f | 2007-01-30 11:10:44 +0000 | [diff] [blame] | 323 | * nih/string.c (nih_vsprintf): We need to copy the arguments before |
| 324 | iterating either time, otherwise we could return NULL after moving |
| 325 | the current argument off the end. |
| 326 | |
Scott James Remnant | 3e48360 | 2007-01-30 11:01:21 +0000 | [diff] [blame] | 327 | * TODO: Update. |
| 328 | |
Scott James Remnant | f7d81e9 | 2007-01-22 09:51:17 +0800 | [diff] [blame] | 329 | 2007-01-22 Scott James Remnant <scott@netsplit.com> |
| 330 | |
Scott James Remnant | 6d0c298 | 2007-01-22 05:22:20 +0000 | [diff] [blame] | 331 | * nih/io.c (nih_io_reopen): Raises an error (usually ENOMEM), since |
| 332 | it can also raise EBADF. |
| 333 | * nih/tests/test_io.c (test_reopen): Make sure ENOMEM is raised. |
| 334 | * nih/watch.c: New watch API, this is a little higher level than |
| 335 | what previously existing in nih/file.c; but is substantially easier |
| 336 | to use and should cover all of the corner cases. |
| 337 | (INOTIFY_EVENTS): inotify events we always watch for. |
| 338 | (nih_watch_new): The master function; this creates a new inotify |
| 339 | instance and adds a watch for a path in it. |
| 340 | (nih_watch_handle_by_wd): Obtain a watch handle by descriptor |
| 341 | (nih_watch_handle_by_path): Obtain a watch handle by path |
| 342 | (nih_watch_add): Another useful function, adds a second path to |
| 343 | an existing watch; normally used just for sub-directories, but |
| 344 | possible for anything. |
| 345 | (nih_watch_add_visitor): nih_dir_walk() callback that calls the above |
| 346 | (nih_watch_free): Free a watch, and the associated NihIo; closing the |
| 347 | inotify descriptor. |
| 348 | (nih_watch_reader): Reader function; handles the incoming stream of |
| 349 | inotify events by locating the watch handle and dispatching through |
| 350 | (nih_watch_handle): this function which handles all the various |
| 351 | event ordering corner-cases and dispatches to the watch functions |
| 352 | proper. |
| 353 | * nih/watch.h: Typedefs, structures and prototypes for the new watch |
| 354 | API. |
| 355 | * nih/tests/test_watch.c: Test suite for the watch code; covers most |
| 356 | of the paths -- though malloc checking here is tricky and could do |
| 357 | with improving later. |
| 358 | * nih/libnih.h: Include nih/watch.h |
| 359 | * nih/Makefile.am (libnih_la_SOURCES): Build and link watch.c |
| 360 | (nihinclude_HEADERS): Install watch.h |
| 361 | (TESTS): Build and run watch test suite |
| 362 | (test_watch_SOURCES, test_watch_LDFLAGS, test_watch_LDADD): Details |
| 363 | for watch test suite binary. |
| 364 | |
Scott James Remnant | a8b296e | 2007-01-22 03:59:51 +0000 | [diff] [blame] | 365 | * nih/file.c: Strip out anything related to inotify, leaving us |
| 366 | with just three functions; nih_file_map(), nih_file_unmap() and |
| 367 | nih_dir_walk(). Others that will turn up here will be matching |
| 368 | and filtering functions. |
| 369 | * nih/file.h: Strip out typedefs, structures and prototypes for |
| 370 | anything watch-related; add attributes to functions as necessary. |
| 371 | * nih/tests/test_file.c: Remove watch-related test cases, and |
| 372 | use TEST_ALLOC_FAIL for test_dir_walk(). |
| 373 | |
Scott James Remnant | 9508a7c | 2007-01-22 03:01:24 +0000 | [diff] [blame] | 374 | * nih/tests/test_io.c (test_shutdown): Test NIH_IO_MESSAGE using |
| 375 | AF_UNIX socketpairs, not pipes. |
| 376 | |
Scott James Remnant | 4a5db84 | 2007-01-22 02:47:50 +0000 | [diff] [blame] | 377 | * HACKING: Document the requirements for function attributes and |
| 378 | using TEST_ALLOC_FAIL in test cases. |
| 379 | * TODO: Update. |
| 380 | |
Scott James Remnant | b73a3e5 | 2007-01-22 02:38:28 +0000 | [diff] [blame] | 381 | * nih/tests/test_signal.c (test_set_handler): Check that SIGCHLD |
| 382 | gets the SA_NOCLDSTOP flag, and that SIGKILL returns an error. |
| 383 | (test_set_default, test_set_ignore): Check SIGKILL returns error. |
| 384 | |
Scott James Remnant | 7568b08 | 2007-01-22 02:37:57 +0000 | [diff] [blame] | 385 | * nih/tests/test_option.c (test_parser): Check that duplicated |
| 386 | options result in the previous string being freed. |
| 387 | |
Scott James Remnant | 397ca83 | 2007-01-22 02:27:25 +0000 | [diff] [blame] | 388 | * nih/main.c (nih_main_daemonise): SIGHUP can always be ignored. |
| 389 | |
Scott James Remnant | 13c76e1 | 2007-01-22 02:27:03 +0000 | [diff] [blame] | 390 | * nih/tests/test_io.c (test_reopen): Make sure that we can't reopen |
| 391 | a closed file descriptor. |
| 392 | (test_set_nonblock, test_set_cloexec): Check with closed descriptors. |
| 393 | |
Scott James Remnant | 47e438c | 2007-01-22 02:18:10 +0000 | [diff] [blame] | 394 | * nih/config.c: When we call nih_config_skip_comment, we can usually |
| 395 | assert that this will never fail; so do so. |
| 396 | |
Scott James Remnant | a178854 | 2007-01-22 02:07:49 +0000 | [diff] [blame] | 397 | * nih/tests/test_command.c (test_help): Check a few missing pieces |
| 398 | of the command help output to make sure it's right. |
| 399 | |
Scott James Remnant | 4afd8c4 | 2007-01-22 01:56:32 +0000 | [diff] [blame] | 400 | * nih/file.c (nih_dir_walk): Correct doc string to indicate that |
| 401 | this function raises errors. |
| 402 | |
Scott James Remnant | f7d81e9 | 2007-01-22 09:51:17 +0800 | [diff] [blame] | 403 | * nih/alloc.h: Fix prototype orders. |
| 404 | * nih/child.h: Add attributes to important return values. |
| 405 | * nih/config.c: Add attributes to important return values. |
| 406 | * nih/config.h: Add attributes to important return values. |
| 407 | * nih/error.h: Add attributes to important return values. |
| 408 | * nih/io.h: Add attributes to important return values. |
| 409 | * nih/main.h: Add attributes to important return values. |
| 410 | * nih/signal.h: Add attributes to important return values. |
| 411 | * nih/string.h: Add attributes to important return values. |
| 412 | * nih/timer.h: Add attributes to important return values. |
| 413 | * nih/io.c (nih_io_reopen): Don't ignore failure to ignore SIGPIPE. |
| 414 | (nih_io_set_cloexec, nih_io_set_nonblock): The only useful errors |
| 415 | returned is EBADF, so just return -1 for that. |
| 416 | * nih/main.c (nih_main_daemonise): Don't ignore failure to ignore |
| 417 | SIGHUP. |
| 418 | * nih/signal.c (nih_signal_set_handler, nih_signal_set_default) |
| 419 | (nih_signal_set_ignore): The only useful error sigaction returns |
| 420 | is EINVAL, so just return -1. |
| 421 | (nih_signal_reset): Ignore EINVAL errors. |
| 422 | * nih/tests/test_io.c: Use NIH_MUST around function calls that |
| 423 | can fail. |
| 424 | * nih/tests/test_main.c: Use NIH_MUST around function calls that |
| 425 | can fail. |
| 426 | |
Scott James Remnant | db1ce70 | 2007-01-21 19:49:36 +0800 | [diff] [blame] | 427 | 2007-01-21 Scott James Remnant <scott@netsplit.com> |
| 428 | |
| 429 | * nih/test.h (TEST_ALLOC_FAIL): Macro that loops over a block of code |
| 430 | as many times as malloc is called within it, causing each malloc in |
| 431 | turn to be failed so we can increase code coverage. |
| 432 | (nih_test_allocator): Support function for the above; allows dumping |
| 433 | of malloc calls. |
| 434 | * nih/tests/test_child.c (test_add_watch): Use TEST_ALLOC_FAIL |
| 435 | and call nih_child_poll() first to not debug the init function |
| 436 | (test_poll): Remove race conditions by making sure the signal |
| 437 | has reached the child using waitid(). Test the "child we don't |
| 438 | know about has died" branch, along with waitid returning 0 with no |
| 439 | pid (needs a child process). |
| 440 | * nih/tests/test_command.c (test_parser, test_help): Use |
| 441 | TEST_ALLOC_FAIL |
| 442 | * nih/tests/test_config.c (test_next_arg, test_parse_args) |
| 443 | (test_parse_command, test_parse_block): Use TEST_ALLOC_FAIL |
| 444 | * nih/tests/test_error.c (test_raise, test_raise_printf) |
| 445 | (test_push_context, test_return_error): Use TEST_ALLOC_FAIL, to |
| 446 | make sure allocations are retried. |
| 447 | (test_pop_context): Split out from test_push_context. |
| 448 | * nih/tests/test_hash.c (test_new): Use TEST_ALLOC_FAIL |
| 449 | * nih/tests/test_io.c (test_add_watch, test_buffer_new) |
| 450 | (test_buffer_resize, test_buffer_pop, test_buffer_shrink) |
| 451 | (test_buffer_push, test_message_new, test_message_add_control) |
| 452 | (test_message_recv, test_message_send, test_reopen, test_watcher) |
| 453 | (test_read, test_write, test_get, test_printf): Use TEST_ALLOC_FAIL |
| 454 | liberally, make sure every code path involving a malloc gets tested. |
| 455 | * nih/tests/test_list.c (test_new): Use TEST_ALLOC_FAIL |
| 456 | * nih/tests/test_logging.c (test_log_message): Use TEST_ALLOC_FAIL |
| 457 | * nih/tests/test_main.c (test_main_loop_add_func): Use TEST_ALLOC_FAIL |
| 458 | (test_package_string): Use TEST_ALLOC_FAIL and also check repeated |
| 459 | calls return the same string. |
| 460 | (test_version): Use TEST_ALLOC_FAIL to check that allocation can |
| 461 | never fail. |
| 462 | * nih/tests/test_option.c (test_parser, test_version, test_help): |
| 463 | Use TEST_ALLOC_FAIL to make sure we behave |
| 464 | * nih/tests/test_signal.c (test_add_handler): Use TEST_ALLOC_FAIL |
| 465 | and call nih_signal_poll() first to not debug the init function |
| 466 | * nih/tests/test_string.c (test_sprintf, test_vsprintf) |
| 467 | (test_strdup, test_strndup, test_str_split, test_str_wrap) |
| 468 | (test_str_screen_wrap): Use TEST_ALLOC_FAIL |
| 469 | (test_str_screen_width): Check that we discard an illegal columns |
| 470 | variable. |
| 471 | * nih/tests/test_timer.c (test_add_timeout, test_add_periodic) |
| 472 | (test_add_scheduled): Use TEST_ALLOC_FAIL and call nih_timer_poll() |
| 473 | first to make sure we don't debug the init function |
| 474 | * nih/config.c (nih_config_next_arg, nih_config_parse_args) |
| 475 | (nih_config_parse_command, nih_config_parse_block): Allow us to fail |
| 476 | reading a configuration file because we run out of memory; it's not |
| 477 | that important. |
| 478 | * nih/io.c (nih_io_get): Catch failure to remove the string, and |
| 479 | don't remove the delimiter if that happens. |
| 480 | (nih_io_printf): Fix doc, this returns zero, not a length. |
| 481 | * nih/io.h: Fix prototype of nih_io_printf |
| 482 | * nih/logging.c (nih_log_message): Potentially failing message output |
| 483 | is crazy; loop until the alloc succeeds. |
| 484 | * nih/option.c (nih_option_handle): Free the options and arguments |
| 485 | before exiting; not really necessary, but makes valgrind happier. |
| 486 | * nih/string.c (nih_strndup): Failed to correctly detect a failed |
| 487 | allocation. |
| 488 | (nih_str_split): Correct some mistakes with allocations not |
| 489 | being checked. |
| 490 | * nih/libnih.supp: Add tmpfile. |
| 491 | * TODO: Update. |
| 492 | |
Scott James Remnant | 9156abc | 2007-01-11 02:05:14 +0000 | [diff] [blame] | 493 | 2007-01-11 Scott James Remnant <scott@netsplit.com> |
| 494 | |
| 495 | * nih/file.h (NihDirWatch): New structure that defines a high-level |
| 496 | watch on a directory with various handlers to be called. |
| 497 | (NihCreateHandler, NihChangeHandler, NihDeleteHandler): Typedefs. |
| 498 | * nih/file.c (nih_dir_add_watch): Function to create an NihDirWatch |
| 499 | structure and fill it in. |
| 500 | (nih_dir_add_file_watch): Add a watch on a single directory, |
| 501 | catching errors and logging a warning if we can't watch it. |
| 502 | (nih_dir_watcher): Deal with inotify events within a directory tree, |
| 503 | taking care of issues such as re-organising of the directory structure |
| 504 | without ending up with duplicate watches. |
| 505 | (nih_file_reader): Only call the first matching watcher; we hit a |
| 506 | limitation in the inotify API caused by our usage of a single |
| 507 | descriptor. Will fix that shortly. |
| 508 | * nih/tests/test_file.c (test_dir_add_watch): Test that we can add |
| 509 | watches and have everything filled in nicely. |
| 510 | |
Scott James Remnant | 097784a | 2007-01-10 19:12:15 +0000 | [diff] [blame] | 511 | 2007-01-10 Scott James Remnant <scott@netsplit.com> |
| 512 | |
Scott James Remnant | a33dcf1 | 2007-01-10 23:26:10 +0000 | [diff] [blame] | 513 | * nih/file.c (nih_dir_walk): Function to walk a directory tree |
| 514 | calling a function for each object found. |
| 515 | * nih/file.h (NihFileFilter, NihFileVisitor): typedefs for |
| 516 | function pointers used for nih_dir_walk. |
| 517 | * nih/tests/test_file.c (test_walk): Test the walker. |
| 518 | |
Scott James Remnant | 38c4555 | 2007-01-10 22:51:57 +0000 | [diff] [blame] | 519 | * nih/file.c (nih_file_reader): Pass the cookie to the watcher. |
| 520 | * nih/file.h (NihFileWatcher): Add cookie argument. |
| 521 | * nih/tests/test_file.c (test_add_watch): Check the cookie is |
| 522 | passed for a rename. |
| 523 | |
Scott James Remnant | 097784a | 2007-01-10 19:12:15 +0000 | [diff] [blame] | 524 | * nih/file.c (nih_file_add_watch): Fix this to not add the inotify |
| 525 | watch unless it can allocate memory to handle it. |
| 526 | |
Scott James Remnant | f3a6248 | 2007-01-09 16:16:47 +0000 | [diff] [blame] | 527 | 2007-01-09 Scott James Remnant <scott@netsplit.com> |
| 528 | |
Scott James Remnant | f075fd8 | 2007-01-09 20:11:58 +0000 | [diff] [blame] | 529 | * nih/config.c (nih_config_get_stanza): Catch entries with a zero |
| 530 | length name, and return one instead of NULL if it exists. |
| 531 | * nih/tests/test_config.c (test_parse_stanza): Make sure that "" |
| 532 | in a stanza table acts as a catch-all. |
| 533 | |
Scott James Remnant | f3a6248 | 2007-01-09 16:16:47 +0000 | [diff] [blame] | 534 | * nih/test.h (TEST_FILENAME): Use dashes not colons, to make things |
| 535 | more clear. |
| 536 | |
Scott James Remnant | e5234c2 | 2007-01-08 11:39:23 +0000 | [diff] [blame] | 537 | 2007-01-08 Scott James Remnant <scott@netsplit.com> |
| 538 | |
Scott James Remnant | 623868b | 2007-01-08 13:19:30 +0000 | [diff] [blame] | 539 | * nih/config.c (nih_config_has_token): add a very small test function |
| 540 | so parsers can peek to see whether there is a next argument or not. |
| 541 | (nih_config_skip_comment, nih_config_parse_args) |
| 542 | (nih_config_parse_file): Use the new test function to make it more |
| 543 | obvious what we're doing. |
| 544 | * nih/config.h: Add prototype. |
| 545 | * nih/tests/test_config.c (test_has_token): Add test cases. |
| 546 | |
Scott James Remnant | 32d5be8 | 2007-01-08 12:45:09 +0000 | [diff] [blame] | 547 | * nih/config.c: Allow all functions to be called with a zero length |
| 548 | file, we're completely guarded against pos going past the length, |
| 549 | so this cannot be a bad thing. Plus this allows zero-length tokens |
| 550 | to be extracted trivially. |
| 551 | (nih_config_next_arg): Raise an error if called in a position where |
| 552 | there is no argument. If you want to speculatively check for args, |
| 553 | peek first. |
| 554 | (nih_config_parse_stanza): No need to check for an empty stanza now, |
| 555 | nih_config_next_arg() handles that for us. |
| 556 | (nih_config_skip_comment): Function to allow us to skip only a |
| 557 | comment, while raising an error if we hit anything else. |
| 558 | (nih_config_parse_args, nih_config_parse_command): Skip comment only, |
| 559 | to guard against parser errors. |
| 560 | * nih/config.h: Update. |
| 561 | * nih/tests/test_config.c (test_next_arg): Check the new error is |
| 562 | raised, instead of the empty string being returned. |
| 563 | (test_parse_stanza): Check the expected token error is raised. |
| 564 | (test_skip_comment): Test the new function. |
| 565 | * nih/errors.h: Add new errors. |
| 566 | |
Scott James Remnant | 4e6f18f | 2007-01-08 11:39:42 +0000 | [diff] [blame] | 567 | * nih/errors.h: Fix capitalisation of error messages. |
| 568 | |
Scott James Remnant | e5234c2 | 2007-01-08 11:39:23 +0000 | [diff] [blame] | 569 | * nih/tests/test_config.c (test_parse_command): Add missing free |
| 570 | calls to strings obtained. |
| 571 | |
Scott James Remnant | 14962b3 | 2007-01-07 03:35:15 +0000 | [diff] [blame] | 572 | 2007-01-07 Scott James Remnant <scott@netsplit.com> |
| 573 | |
Scott James Remnant | bf7ed8e | 2007-01-07 21:36:32 +0000 | [diff] [blame] | 574 | * nih/config.c: Convert this file to use size_t where appropriate |
| 575 | instead of ssize_t, and raise exceptions for parsing errors rather |
| 576 | than logging them. |
| 577 | (nih_config_parse): Check a size is not greater then SSIZE_MAX (2GB) |
| 578 | to avoid overflows. |
| 579 | * nih/config.h: Update prototypes and handler function typedef. |
| 580 | * nih/errors.h: Add new error codes and strings. |
| 581 | * nih/tests/test_config.c: Adjust test cases. |
| 582 | |
Scott James Remnant | 2dad869 | 2007-01-07 11:36:43 +0000 | [diff] [blame] | 583 | * nih/config.c (nih_config_parse_file): Function to parse a mapped |
| 584 | file or string line-by-line starting from the given position. |
| 585 | (nih_config_parse): Function to map a file into memory and parse it |
| 586 | * nih/config.h: Add prototypes. |
| 587 | * nih/tests/test_config.c (test_parse_file): Test the function with |
| 588 | a small variety of different valid files. |
| 589 | (test_parse): Check we can parse a file, and get an error if it |
| 590 | doesn't exist. |
| 591 | |
Scott James Remnant | a10a774 | 2007-01-07 03:41:56 +0000 | [diff] [blame] | 592 | * nih/config.c (nih_config_parse_stanza): Take a data pointer and |
| 593 | pass it to the handler, otherwise we can't fill in structures. |
| 594 | * nih/config.h: Update. |
| 595 | * nih/tests/test_config.c (test_parse_stanza): Check the data |
| 596 | pointer is passed properly. |
| 597 | |
Scott James Remnant | 91e0f50 | 2007-01-07 03:38:17 +0000 | [diff] [blame] | 598 | * nih/tests/test_option.c (test_version, test_help): Capture the |
| 599 | return value from nih_option_parser, as we've set gcc attributes to |
| 600 | not let us do otherwise. |
| 601 | |
Scott James Remnant | 14962b3 | 2007-01-07 03:35:15 +0000 | [diff] [blame] | 602 | * nih/config.h: Add structures, typedefs and macros to allow lists |
| 603 | of configuration stanzas to be built up. |
| 604 | * nih/config.c (nih_config_parse_args): Split argument parsing into |
| 605 | (nih_config_next_arg): This new function that wraps next_token and |
| 606 | also skips following whitespace. |
| 607 | (nih_config_next_line): Another new function that skips to the end |
| 608 | of the line, replacing severael copies of this code. |
| 609 | (nih_config_get_stanza): Simple function to find a stanza in a table |
| 610 | by its name. |
| 611 | (nih_config_parse_stanza): Simple stanza dispatch function; parses an |
| 612 | argument at the current position, looks it up in the table, then |
| 613 | calls the function. |
| 614 | * nih/tests/test_config.c (test_next_arg): Check this function works, |
| 615 | we know it does because it was covered by other tests, but it's worth |
| 616 | having its own as well. |
| 617 | (test_next_line): Check this function works too. |
| 618 | (test_parse_stanza): Make sure the dispatcher works properly. |
| 619 | * nih/config.c: Write from the code that was used for upstart, |
| 620 | making them exported functions to act as a configuration file kit. |
| 621 | (nih_config_parse_args): Fix a bug where lineno wasn't incremented |
| 622 | for an embedded newline in between arguments. Fix another bug where |
| 623 | a line containing only whitespace or whitespace and a comment would |
| 624 | hit an assertion - not a problem in practice, but it's a bug. |
| 625 | * nih/config.h: Function prototypes. |
| 626 | * nih/libnih.h: Include config.h |
| 627 | * nih/tests/test_config.c: Write an all new test suite that tests |
| 628 | the individual parsing functions for their functionality, rather |
| 629 | than trying to squeeze it into something larger. |
| 630 | * nih/Makefile.am (libnih_la_SOURCES): Build and link config.c |
| 631 | (nihinclude_HEADERS): Install config.h |
| 632 | (TESTS): Build and run config test suite |
| 633 | (test_config_SOURCES, test_config_LDFLAGS, test_config_LDADD): Config |
| 634 | test suite binary details. |
| 635 | |
Scott James Remnant | 939ff8e | 2007-01-06 19:28:37 +0000 | [diff] [blame] | 636 | 2007-01-06 Scott James Remnant <scott@netsplit.com> |
| 637 | |
Scott James Remnant | 14962b3 | 2007-01-07 03:35:15 +0000 | [diff] [blame] | 638 | * nih/tests/test_io.c (test_watcher): Missing a priority that needed |
| 639 | changing to message. |
| 640 | |
Scott James Remnant | 68e6f92 | 2007-01-06 21:14:37 +0000 | [diff] [blame] | 641 | * nih/command.h: Warn against unused results. |
| 642 | |
Scott James Remnant | 397a060 | 2007-01-06 21:14:13 +0000 | [diff] [blame] | 643 | * nih/option.h: Warn against unused results. |
| 644 | |
Scott James Remnant | 939ff8e | 2007-01-06 19:28:37 +0000 | [diff] [blame] | 645 | * nih/logging.h (NihLogLevel): Add a message level between info |
| 646 | and warn, as we can't just re-use warn as that goes to stderr! |
| 647 | (nih_message): Change to use the new message level. |
| 648 | * nih/logging.c (nih_logger_syslog): Output messages at the notice |
| 649 | level, rather than the warning level. |
| 650 | (nih_log_init): Change the default priority to message. |
| 651 | * nih/tests/test_logging.c (test_log_message): Check that messages |
| 652 | are logged with the new message priority; reset to the new default. |
| 653 | (test_logger_printf): Make sure that ordinary messages go to stdout |
| 654 | and warning messages go to stderr. |
| 655 | (test_set_logger, test_set_priority): Reset to the new default. |
| 656 | * nih/tests/test_option.c (test_quiet, test_verbose, test_debug): |
| 657 | Check that messages are also logged, as well as warning; and set |
| 658 | the new default priority. |
| 659 | * nih/tests/test_error.c (test_raise_again, test_push_context): |
| 660 | Set log priority to the new default. |
| 661 | * nih/tests/test_io.c (test_watcher): Reset priority to the new |
| 662 | default. |
| 663 | |
Scott James Remnant | cd88dd3 | 2007-01-05 17:42:36 +0000 | [diff] [blame] | 664 | 2007-01-05 Scott James Remnant <scott@netsplit.com> |
| 665 | |
Scott James Remnant | 095a907 | 2007-01-05 18:47:11 +0000 | [diff] [blame] | 666 | * nih/tests/test_io.c (test_shutdown): Uncomment the test for |
| 667 | shutdown when all messages are processed by the watcher. |
| 668 | |
Scott James Remnant | 0bab143 | 2007-01-05 18:41:31 +0000 | [diff] [blame] | 669 | * nih/io.c (nih_io_message_recv): Remove note about the remote end |
| 670 | being closed; when in message mode, this doesn't usually happen. |
| 671 | (nih_io_watcher): Only check for a zero length return if we're in |
| 672 | stream mode, otherwise it just means we got a zero length message. |
| 673 | (nih_io_watcher_read): Accept zero length messages and return them. |
| 674 | * nih/tests/test_io.c (test_watcher): Remove tests that tried to |
| 675 | mix a message-mode io and a dgram socket, that way lies disaster. |
| 676 | |
Scott James Remnant | a2e399e | 2007-01-05 17:56:38 +0000 | [diff] [blame] | 677 | * nih/io.c (nih_io_watcher_read, nih_io_watcher_write): Initialise |
| 678 | len to zero, as valgrind can be fussy about this when we call things |
| 679 | directly. |
| 680 | |
Scott James Remnant | cd88dd3 | 2007-01-05 17:42:36 +0000 | [diff] [blame] | 681 | * nih/io.h (NihIoMessage): Add a user data field to the message |
| 682 | structure so we can carry the pid around when queuing notification |
| 683 | messages in upstart. |
| 684 | |
Scott James Remnant | 12d53b0 | 2007-01-02 15:29:33 +0000 | [diff] [blame] | 685 | 2007-01-02 Scott James Remnant <scott@netsplit.com> |
| 686 | |
Scott James Remnant | f1d97b5 | 2007-01-02 18:46:01 +0000 | [diff] [blame] | 687 | * nih/alloc.h, nih/child.h, nih/command.h, nih/file.h, nih/hash.h: |
| 688 | nih/io.h, nih/logging.h, nih/main.h, nih/option.h, nih/signal.h: |
| 689 | nih/timer.h: Give names for all arguments in function pointer typedefs |
| 690 | so the documentation strings make more sense. |
| 691 | |
Scott James Remnant | 45b62a8 | 2007-01-02 16:51:24 +0000 | [diff] [blame] | 692 | * nih/test.h (TEST_EQ_MEM, TEST_NE_MEM): Cast argument for number |
| 693 | of bytes to size_t. |
| 694 | |
Scott James Remnant | 12d53b0 | 2007-01-02 15:29:33 +0000 | [diff] [blame] | 695 | * configure.ac (AC_COPYRIGHT): Update copyright to 2007. |
| 696 | |
Scott James Remnant | 2a00129 | 2006-12-29 10:36:40 +0000 | [diff] [blame] | 697 | 2006-12-29 Scott James Remnant <scott@netsplit.com> |
| 698 | |
Scott James Remnant | 7a21d4e | 2006-12-29 11:55:11 +0000 | [diff] [blame] | 699 | * nih/errors.h: Drop the NIH_IO_MESSAGE_TRUNCATED error. |
| 700 | |
Scott James Remnant | e503225 | 2006-12-29 11:54:25 +0000 | [diff] [blame] | 701 | * nih/io.h (NihIoMessage): Rename msg_buf member to data, and change |
| 702 | ctrl_buf member to be an array of cmsg structures called control. |
| 703 | * nih/io.c: Update references to NihIoMessage members. |
| 704 | (nih_io_message_push_control): Rename to nih_io_message_add_control |
| 705 | (nih_io_message_add_control): Rewrite to add the control message |
| 706 | header onto the end of an array, rather than a control buffer, |
| 707 | (nih_io_message_recv): After receiving the message, extract all |
| 708 | control messages and put them into the array. |
| 709 | (nih_io_message_send): Take control messages from the array into a |
| 710 | single buffer and send them. |
| 711 | |
| 712 | * nih/tests/test_io.c: Update references to NihIoMessage members. |
| 713 | (test_message_new): Check that the control member is initialised to |
| 714 | a one-element array containing NULL. |
| 715 | (test_message_push_control): Rename to test_message_add_control. |
| 716 | (test_message_add_control): Check the array is extended. |
| 717 | |
Scott James Remnant | 2a00129 | 2006-12-29 10:36:40 +0000 | [diff] [blame] | 718 | * nih/io.c (nih_io_message_recv): Loop over a call to recvmsg() with |
| 719 | MSG_PEEK in its arguments to avoid ever returning truncated messages. |
| 720 | * nih/tests/test_io.c (test_message_recv): Adjust test for truncated |
| 721 | messages to make sure they do in fact work. |
| 722 | (test_watcher): Remove the oversized message error check. |
| 723 | |
Scott James Remnant | 0a10bc4 | 2006-12-21 00:24:05 +0000 | [diff] [blame] | 724 | 2006-12-21 Scott James Remnant <scott@netsplit.com> |
| 725 | |
Scott James Remnant | 209c9b1 | 2006-12-21 18:21:47 +0000 | [diff] [blame] | 726 | * nih/tests/test_option.c (test_verbose): Add missing call to free |
| 727 | args. |
| 728 | |
Scott James Remnant | 5c5f7a9 | 2006-12-21 17:47:43 +0000 | [diff] [blame] | 729 | * nih/io.c (nih_io_message_send): Change to return the ssize_t |
| 730 | received from sendmsg(), rather than an int. |
| 731 | (nih_io_watcher_read): Move read functionality out of |
| 732 | nih_io_watcher into a separate function that can deal with both |
| 733 | stream and message mode. |
| 734 | (nih_io_watcher_write): Move write functionality out of nih_io_watcher |
| 735 | into a separate function that can deal with both stream and message |
| 736 | mode. |
| 737 | (nih_io_watcher): Call the separate functions, and handle calling |
| 738 | the reader when in message mode. In addition, we now check the |
| 739 | error code when writing to a socket as well; there are useful errors |
| 740 | there (like ECONNREFUSED). |
| 741 | * nih/io.h: Update prototype of nih_io_message_send. |
| 742 | * nih/tests/test_io.c (test_message_send): Update return checks. |
| 743 | (test_watcher): Test that the error handled can now be called when |
| 744 | writing data to a socket, as well as just when reading. Test |
| 745 | message mode behaviour. |
| 746 | |
Scott James Remnant | be45d1f | 2006-12-21 01:00:11 +0000 | [diff] [blame] | 747 | * nih/io.c (nih_io_send_message): Watch socket for writability. |
| 748 | (nih_io_write): Extend this function to work in message mode; |
| 749 | it allocates a new message, stores the data in that buffer, and |
| 750 | adds it to the send queue. |
| 751 | (nih_io_printf): Remove restriction that this only be called in |
| 752 | stream mode; the fact this calls nih_io_write is sufficient to |
| 753 | ensure correct behaviour. |
| 754 | * nih/tests/test_io.c (test_send_message): Check that we're testing |
| 755 | for writability. |
| 756 | (test_write): Test that this works in message mode. |
| 757 | (test_printf): Check that this works too, even though this only |
| 758 | really calls nih_io_write. |
| 759 | |
Scott James Remnant | 292fec2 | 2006-12-21 00:42:36 +0000 | [diff] [blame] | 760 | * nih/io.c (nih_io_get): Extend so that this can operate in message |
| 761 | mode on the oldest message in the queue. |
| 762 | * nih/tests/test_io.c (test_get): Check that this works properly |
| 763 | in message mode; complete with shutdown check. |
| 764 | |
Scott James Remnant | 0a10bc4 | 2006-12-21 00:24:05 +0000 | [diff] [blame] | 765 | * nih/io.c (nih_io_message_new): Do not assign a default list |
| 766 | destructor, it's not in a hidden list and there are bad consequences |
| 767 | of freeing a child with a default destructor if the list its in gets |
| 768 | freed first; new rule - default destructors only if the list is hidden |
| 769 | and never freed! |
| 770 | (nih_io_closed, nih_io_shutdown): Don't call the close handler if |
| 771 | the structure is already marked to be closed; there seems little |
| 772 | point, and we could accidentally call it multiple times. |
| 773 | (nih_io_read_message, nih_io_read, nih_io_get): Check whether we |
| 774 | need to shutdown the socket here, in case the watcher isn't polled |
| 775 | again. |
| 776 | * nih/tests/test_io.c (test_shutdown): Check that shutdown works |
| 777 | with message-mode structures (part of this disabled for now). |
| 778 | (test_read_message, test_read, test_get): Check that a shutdown |
| 779 | socket is closed when these are called. |
| 780 | |
Scott James Remnant | 6618ee6 | 2006-12-20 12:28:33 +0000 | [diff] [blame] | 781 | 2006-12-20 Scott James Remnant <scott@netsplit.com> |
| 782 | |
Scott James Remnant | 594cae0 | 2006-12-20 23:26:52 +0000 | [diff] [blame] | 783 | * nih/io.c (nih_io_read): Extend so that it can be called in |
| 784 | message mode, it reads from the first message until it has been |
| 785 | exhausted; at which point it frees the message and the next call |
| 786 | would read from the next. |
| 787 | * nih/tests/test_io.c (test_read): Check that the new functionality |
| 788 | works properly. |
| 789 | |
Scott James Remnant | 5d10da0 | 2006-12-20 22:53:53 +0000 | [diff] [blame] | 790 | * nih/io.c (nih_io_first_message): Simple static function to obtain |
| 791 | the oldest message in the receive queue. |
| 792 | (nih_io_read_message, nih_io_send_message): Functions to take the |
| 793 | oldest message out of the receive queue and append a message to the |
| 794 | send queue. |
| 795 | * nih/io.h: Add prototypes. |
| 796 | * nih/tests/test_io.c (test_read_message, test_send_message): Check |
| 797 | the new functions do what they say on the tin. |
| 798 | |
Scott James Remnant | eb09822 | 2006-12-20 14:24:03 +0000 | [diff] [blame] | 799 | General clean-up of nih_io, fixing a few API issues and making it |
| 800 | more suitable for using in message mode. |
| 801 | |
| 802 | * nih/io.c (nih_io_buffer_pop, nih_io_buffer_shrink): Remove the |
| 803 | silly restrictions that these cannot be called with a length greater |
| 804 | than the buffer size, instead just truncate it to the buffer size. |
| 805 | (nih_io_buffer_pop): Length is now updated to the actual number of |
| 806 | bytes being returned. |
| 807 | (nih_io_message_add_control): Rename to nih_io_message_push_control. |
| 808 | (nih_io_message_recv): Change the len parameter to a pointer that's |
| 809 | updated with the actual number of bytes read. |
| 810 | (nih_io_stream_watcher): Rename back to nih_io_watcher. |
| 811 | (nih_io_reopen): Use a single watcher function again, initialise close |
| 812 | to NULL. Treat failure to set a descriptor non-blocking as a failure |
| 813 | to open; otherwise we'll end up screwing up the main loop. |
| 814 | (nih_io_watcher): Remove the restriction that this is only called |
| 815 | when in the stream mode. Leave data in the receive buffer if there's |
| 816 | no reader function, it's now valid to query the buffer size and read |
| 817 | by other means. Catch the ENOMEM error and ignore it. Set and keep |
| 818 | an eye on the structure close member, if it is TRUE before we return, |
| 819 | close the socket. This also means we check for shutdown sockets in |
| 820 | the case of error, which we probably should have done. |
| 821 | (nih_io_maybe_shutdown): Rename to nih_io_shutdown_check. |
| 822 | (nih_io_close): If the close member of the structure is not NULL |
| 823 | we're inside a watcher function, so need to set the variable this |
| 824 | points to to TRUE instead of closing or freeing the structure. |
| 825 | (nih_io_read): Change the len parameter to be updated with the |
| 826 | actual number of bytes being returned. |
| 827 | * nih/io.h: Renamed function prototype. Updated documentation for |
| 828 | function typedefs to clarify that they may all call nih_io_close, |
| 829 | but may not call nih_free. |
| 830 | * nih/errors.h: Rename NIH_TRUNCATED_MESSAGE to |
| 831 | NIH_IO_MESSAGE_TRUNCATED, we should probably namespace these. |
| 832 | * nih/tests/test_io.c (test_buffer_pop, test_buffer_shrink): Check |
| 833 | that we can pop or shrink the entire buffer if we ask for more. |
| 834 | (test_message_add_control): Rename to test_push_control. |
| 835 | (test_message_recv): Check that the cases of remote end closed, |
| 836 | error received or truncated message are handled properly. |
| 837 | (test_message_send): Check that an error is handled. |
| 838 | (test_stream_watcher): Rename back to test_watcher. |
| 839 | (test_reopen): Check that the socket is not being shutdown or closed. |
| 840 | (test_shutdown): Drain the buffer before calling handle on it, as |
| 841 | it's not done automatically now. |
| 842 | (test_close): Check that a lazy close is performed if io->close is |
| 843 | not NULL. |
| 844 | * nih/file.c (nih_file_reader): Update call to nih_io_read. |
| 845 | |
Scott James Remnant | 6618ee6 | 2006-12-20 12:28:33 +0000 | [diff] [blame] | 846 | * nih/logging.h (nih_assert_notreached): Rename to |
| 847 | nih_assert_not_reached, this was annoying me. |
| 848 | |
Scott James Remnant | 73caada | 2006-12-19 17:59:48 +0000 | [diff] [blame] | 849 | 2006-12-19 Scott James Remnant <scott@netsplit.com> |
| 850 | |
Scott James Remnant | 610ec39 | 2006-12-19 22:14:17 +0000 | [diff] [blame] | 851 | * nih/io.c (nih_io_read, nih_io_write, nih_io_get, nih_io_printf): |
| 852 | Ensure the NihIo structure is in stream mode; as these only really |
| 853 | make sense if there's a limitless buffer. |
| 854 | |
Scott James Remnant | 54cbe38 | 2006-12-19 21:39:28 +0000 | [diff] [blame] | 855 | * nih/tests/test_io.c (test_shutdown): Make sure the socket is |
| 856 | shut down immediately. |
| 857 | * nih/io.c (nih_io_shutdown): Bugfix, should close the socket |
| 858 | immediately if there's nothing in the queue, otherwise it may |
| 859 | hang around forever if it never polls. |
| 860 | |
Scott James Remnant | 499cf16 | 2006-12-19 21:28:19 +0000 | [diff] [blame] | 861 | * nih/io.c (nih_io_reopen): Receive the type from the arguments, |
| 862 | instead of hard-coding to be stream. Set up the structure accordingly. |
| 863 | * nih/io.h: Update prototype. |
| 864 | * nih/tests/test_io.c (test_reopen): Check message mode is allocated |
| 865 | properly. |
| 866 | * nih/file.c (nih_file_init): Open in stream mode. |
| 867 | |
Scott James Remnant | 687f1f8 | 2006-12-19 21:10:30 +0000 | [diff] [blame] | 868 | * nih/io.c (nih_io_message_new): Catch failure to allocate message |
| 869 | or control buffer. |
| 870 | (nih_io_message_add_control): No need to try and allocate the control |
| 871 | buffer here. |
| 872 | (nih_io_message_recv): Only need to resize the buffers here as well. |
| 873 | (nih_io_message_send): No need to deal with there being no message |
| 874 | or control buffer here either. |
| 875 | * nih/tests/test_io.c: Fix test assumptions based on above. |
| 876 | * nih/libnih.supp: Add missing nih_io_init suppression. |
| 877 | |
| 878 | * nih/tests/test_io.c (test_message_add_control): Non need to check |
| 879 | allocation of the buffer itself. |
| 880 | |
Scott James Remnant | 332f2b0 | 2006-12-19 20:40:51 +0000 | [diff] [blame] | 881 | * nih/io.c (nih_io_message_add_control): Function to add a control |
| 882 | message to the control buffer, to save mucking around with difficult |
| 883 | bits ourselves. |
| 884 | * nih/io.h: Add prototype. |
| 885 | * nih/tests/test_io.c (test_message_add_control): Check that it |
| 886 | works properly. |
| 887 | |
Scott James Remnant | 054bbbc | 2006-12-19 18:14:32 +0000 | [diff] [blame] | 888 | * nih/io.c (nih_io_buffer_shrink): Make an exported function, resize |
| 889 | the buffer once done to save on memory. |
| 890 | (nih_io_buffer_pop, nih_io_stream_watcher): No need to explicitly |
| 891 | resize here now, as it gets called from shrink. |
| 892 | * nih/io.h: Add prototype. |
| 893 | * nih/tests/test_io.c (test_buffer_shrink): Test shrink. |
| 894 | |
Scott James Remnant | 73caada | 2006-12-19 17:59:48 +0000 | [diff] [blame] | 895 | * nih/io.c (nih_io_message_recv, nih_io_message_send): Functions |
| 896 | to send and receive a message over a socket, hiding the difficult |
| 897 | bits of dealing with msghdr/iovec. |
| 898 | (nih_io_get_family): Function to detect the family of a socket. |
| 899 | * nih/io.h: Update. |
| 900 | * nih/errors.h: Add truncated message error. |
| 901 | * nih/tests/test_io.c (test_message_recv, test_message_send): Check |
| 902 | that we can send and receive messages by using socket pairs. |
| 903 | (test_get_family): Check that we can get the families of the standard |
| 904 | three socket types. |
| 905 | |
Scott James Remnant | 85a241a | 2006-12-18 14:48:39 +0000 | [diff] [blame] | 906 | 2006-12-18 Scott James Remnant <scott@netsplit.com> |
| 907 | |
| 908 | * nih/io.h (NihIoMessage): Structure that represents an individual |
| 909 | message in a queue; has a buffer for the message, and for ancillary |
| 910 | control data, as well as an address that the message is being sent |
| 911 | to or received from. |
| 912 | (NihIoType): Enum to select whether an NihIo structure is in stream |
| 913 | mode or message mode. |
| 914 | (NihIo): Add a type member to select whether this is in stream or |
| 915 | message mode, and a union to select whether we're using buffers |
| 916 | or message queues. |
| 917 | * nih/io.c (nih_io_message_new): Allocate an NihIoMessage and its |
| 918 | child buffers. |
| 919 | (nih_io_reopen): Initialise the type to NIH_IO_STREAM. |
| 920 | (nih_io_watcher): Rename to nih_io_stream_watcher. |
| 921 | * nih/tests/test_io.c (test_message_new): Check that the new message |
| 922 | structure is initialised properly. |
| 923 | (test_reopen): Check that we get a stream structure by default. |
| 924 | (test_watcher): Rename to test_stream_watcher. |
| 925 | |
Scott James Remnant | d79e0ae | 2006-12-17 14:23:52 +0000 | [diff] [blame] | 926 | 2006-12-17 Scott James Remnant <scott@netsplit.com> |
| 927 | |
Scott James Remnant | 8b5bec6 | 2006-12-17 18:53:24 +0000 | [diff] [blame] | 928 | * nih/logging.h (nih_assert_notreached): Add an assertion for the |
| 929 | use in default bits of switches, etc. |
| 930 | |
Scott James Remnant | d614c61 | 2006-12-17 16:52:31 +0000 | [diff] [blame] | 931 | * nih/test.h (TEST_EQ_U, TEST_NE_U): Versions of the original macros |
| 932 | that cast to size_t for display, instead of ssize_t. |
| 933 | |
Scott James Remnant | d79e0ae | 2006-12-17 14:23:52 +0000 | [diff] [blame] | 934 | * nih/tests/test_logging.c, nih/tests/test_string.c: Set local |
| 935 | variables to avoid gcc thinking that they may be unused when |
| 936 | using TEST_DIVERT_*. |
| 937 | |
Scott James Remnant | 5a34b9c | 2006-12-14 11:39:27 +0000 | [diff] [blame] | 938 | 2006-12-14 Scott James Remnant <scott@netsplit.com> |
| 939 | |
| 940 | * HACKING: Correct some typos. |
| 941 | |
Scott James Remnant | 104bb08 | 2006-12-13 18:19:48 +0000 | [diff] [blame] | 942 | 2006-12-13 Scott James Remnant <scott@netsplit.com> |
| 943 | |
| 944 | * nih/test.h (TEST_FILENAME): Wrap with do { ... } while (0) |
| 945 | in case this gets used as a single line statement. |
| 946 | |
Scott James Remnant | d4d63c6 | 2006-12-13 18:05:21 +0000 | [diff] [blame] | 947 | 2006-12-13 Johan Kiviniemi <johan@kiviniemi.name> |
| 948 | |
| 949 | * nih/test.h (TEST_FILE_RESET): Wrap with do { ... } while (0) |
| 950 | in case this gets used as a single line statement. |
| 951 | |
Scott James Remnant | c5f3137 | 2006-12-13 16:54:12 +0000 | [diff] [blame] | 952 | 2006-12-13 Scott James Remnant <scott@netsplit.com> |
| 953 | |
| 954 | * nihify: Link to the nih ChangeLog. |
| 955 | |
Scott James Remnant | 724bf55 | 2006-12-12 11:20:40 +0000 | [diff] [blame] | 956 | 2006-12-12 Scott James Remnant <scott@netsplit.com> |
| 957 | |
Scott James Remnant | 1a00336 | 2006-12-12 17:18:11 +0000 | [diff] [blame] | 958 | * nih/test.h (TEST_CHILD_WAIT, TEST_CHILD_RELEASE): Sometimes the |
| 959 | primitive "when the child is running" locking provided by TEST_CHILD |
| 960 | isn't sufficient, and we actually need to perform some actions in |
| 961 | the child before we let the parent carry on. These two macros |
| 962 | allow that. |
| 963 | |
Scott James Remnant | 1edabdd | 2006-12-12 12:24:44 +0000 | [diff] [blame] | 964 | * nih/libnih.supp: Include a valgrind suppressions file. |
| 965 | * nih/Makefile.am (EXTRA_DIST): Distribute the suppressions file. |
| 966 | |
Scott James Remnant | 561f23e | 2006-12-12 12:06:22 +0000 | [diff] [blame] | 967 | * nih/tests/test_alloc.c (test_realloc): Fix missing free. |
| 968 | |
Scott James Remnant | 724bf55 | 2006-12-12 11:20:40 +0000 | [diff] [blame] | 969 | * configure.ac (AM_GNU_GETTEXT_VERSION): Quote version number. |
| 970 | |
Scott James Remnant | 50b58d5 | 2006-12-09 10:19:58 +0000 | [diff] [blame] | 971 | 2006-12-09 Scott James Remnant <scott@netsplit.com> |
| 972 | |
| 973 | * nih/test.h (TEST_DIVERT_STDOUT_FD, TEST_DIVERT_STDERR_FD): Flush |
| 974 | before dup2ing the original file descriptor back, otherwise we end |
| 975 | up with the content still in the buffer later. |
| 976 | |
Scott James Remnant | a8d6d84 | 2006-12-08 17:07:13 +0000 | [diff] [blame] | 977 | 2006-12-08 Scott James Remnant <scott@netsplit.com> |
| 978 | |
Scott James Remnant | 7e75a6a | 2006-12-08 18:11:05 +0000 | [diff] [blame] | 979 | * HACKING: Document that test cases are expected. |
| 980 | |
Scott James Remnant | a4710a4 | 2006-12-08 18:05:43 +0000 | [diff] [blame] | 981 | * nih/tests/test_command.c: Port to the new test framework. |
| 982 | |
Scott James Remnant | 7f798c9 | 2006-12-08 17:23:37 +0000 | [diff] [blame] | 983 | * nih/tests/test_option.c: Drop unused include. |
| 984 | |
Scott James Remnant | a8d6d84 | 2006-12-08 17:07:13 +0000 | [diff] [blame] | 985 | * nih/tests/test_option.c: Port to the new test framework. |
| 986 | |
Scott James Remnant | 000e9a4 | 2006-12-07 11:43:37 +0000 | [diff] [blame] | 987 | 2006-12-07 Scott James Remnant <scott@netsplit.com> |
| 988 | |
Scott James Remnant | 4aa61bc | 2006-12-07 17:42:19 +0000 | [diff] [blame] | 989 | * nih/tests/test_io.c: Port to the new test framework. |
| 990 | |
Scott James Remnant | 5c797d9 | 2006-12-07 16:00:15 +0000 | [diff] [blame] | 991 | * nih/tests/test_hash.c: Drop use of assert. |
| 992 | |
Scott James Remnant | 43819d3 | 2006-12-07 13:39:30 +0000 | [diff] [blame] | 993 | * nih/tests/test_timer.c (test_poll): Formatting fix. |
| 994 | |
Scott James Remnant | 5295921 | 2006-12-07 13:28:58 +0000 | [diff] [blame] | 995 | * nih/tests/test_string.c: Port to the new test framework. |
| 996 | |
Scott James Remnant | 07dfc47 | 2006-12-07 13:28:45 +0000 | [diff] [blame] | 997 | * nih/test.h (TEST_DIVERT_STDOUT_FD, TEST_DIVERT_STDERR_FD): Macros |
| 998 | to divert to a file descriptor instead of a file. |
| 999 | (TEST_DIVERT_STDOUT, TEST_DIVERT_STDERR): Redefine as wrappers around |
| 1000 | the new macros. |
| 1001 | |
Scott James Remnant | ec3da3f | 2006-12-07 12:57:11 +0000 | [diff] [blame] | 1002 | * nih/tests/test_timer.c: Port to the new test framework. |
| 1003 | |
Scott James Remnant | c7cab09 | 2006-12-07 12:45:19 +0000 | [diff] [blame] | 1004 | * nih/tests/test_signal.c: Port to the new test framework. |
| 1005 | |
Scott James Remnant | 3ca3880 | 2006-12-07 12:14:32 +0000 | [diff] [blame] | 1006 | * nih/tests/test_main.c: Port to the new test framework. |
| 1007 | |
Scott James Remnant | 8b786d3 | 2006-12-07 12:12:02 +0000 | [diff] [blame] | 1008 | * nih/test.h: Cast strlen return value to int when used to give |
| 1009 | the length of a string in printf. |
| 1010 | |
Scott James Remnant | e65ede7 | 2006-12-07 11:43:50 +0000 | [diff] [blame] | 1011 | * nih/tests/test_logging.c: Port to the new test framework. |
| 1012 | |
Scott James Remnant | 000e9a4 | 2006-12-07 11:43:37 +0000 | [diff] [blame] | 1013 | * nih/test.h (TEST_DIVERT_STDOUT, TEST_DIVERT_STDERR): Crazy macros |
| 1014 | to divert stdout or stderr to a different file, making sure it's |
| 1015 | flushed before both dups. |
| 1016 | (TEST_EQ_STRN, TEST_NE_STRN): Functions to check a string up to a |
| 1017 | particular point. |
| 1018 | (TEST_FILE_EQ, TEST_FILE_EQ_N, TEST_FILE_NE, TEST_FILE_NE_N): |
| 1019 | Functions to grab a line from a file and check it against a string. |
| 1020 | (TEST_FILE_END): Function to determine end of file. |
| 1021 | (TEST_FILE_RESET): Another function so I don't need to remember the |
| 1022 | runes to flush, rewind and truncate a file. |
| 1023 | |
Scott James Remnant | c81a255 | 2006-12-06 13:40:16 +0000 | [diff] [blame] | 1024 | 2006-12-06 Scott James Remnant <scott@netsplit.com> |
| 1025 | |
Scott James Remnant | e43ba4c | 2006-12-06 16:30:57 +0000 | [diff] [blame] | 1026 | * nih/tests/test_file.c: Port to the new test framework. |
| 1027 | |
Scott James Remnant | 257f223 | 2006-12-06 16:29:50 +0000 | [diff] [blame] | 1028 | * nih/test.h (TEST_EQ_MEM, TEST_NE_MEM): Tests that wrap memcmp. |
| 1029 | (TEST_FILENAME): Macro to generate a filename. |
| 1030 | |
Scott James Remnant | 787f237 | 2006-12-06 15:57:32 +0000 | [diff] [blame] | 1031 | * nih/tests/test_error.c: Port to the new test framework. |
| 1032 | |
Scott James Remnant | 881b8a1 | 2006-12-06 15:36:27 +0000 | [diff] [blame] | 1033 | * nih/tests/test_alloc.c, nih/tests/test_list.c, nih/tests/test_hash.c: |
| 1034 | Undo over-zealous removing of includes. |
| 1035 | |
Scott James Remnant | ac8e7a1 | 2006-12-06 15:33:45 +0000 | [diff] [blame] | 1036 | * nih/tests/test_child.c: Port to the new test framework. |
| 1037 | |
Scott James Remnant | 6e450a9 | 2006-12-06 15:31:17 +0000 | [diff] [blame] | 1038 | * nih/test.h (TEST_CHILD): Macro to spawn an interlocked child |
| 1039 | process, so we don't keep having to remember how to. |
| 1040 | |
Scott James Remnant | c81a255 | 2006-12-06 13:40:16 +0000 | [diff] [blame] | 1041 | * nih/test.h (TEST_ALLOC_SIZE, TEST_ALLOC_PARENT): Include the |
| 1042 | expression that generated the pointer, as well as the pointer. |
| 1043 | (TEST_LIST_EMPTY, TEST_LIST_NOT_EMPTY): Check whether a list is |
| 1044 | empty or not. |
| 1045 | * nih/tests/test_list.c (test_empty, test_foreach_safe): Use the |
| 1046 | new list test macros instead of TEST_TRUE/TEST_FALSE. |
| 1047 | * nih/tests/test_hash.c (test_new): Likewise. |
| 1048 | |
Scott James Remnant | afcf58b | 2006-12-05 12:22:33 +0000 | [diff] [blame] | 1049 | 2006-12-05 Scott James Remnant <scott@netsplit.com> |
| 1050 | |
Scott James Remnant | 27a4c11 | 2006-12-05 23:37:30 +0000 | [diff] [blame] | 1051 | * nih/tests/test_hash.c: Port to the new test framework. |
| 1052 | |
Scott James Remnant | f119d69 | 2006-12-05 21:38:02 +0000 | [diff] [blame] | 1053 | * nih/tests/test_list.c: Port to the new test framework. |
| 1054 | |
Scott James Remnant | c051f68 | 2006-12-05 20:50:25 +0000 | [diff] [blame] | 1055 | * nih/tests/test_alloc.c: Port to the new test framework. |
| 1056 | (test_set_allocator): Test that the allocator is called with zero |
| 1057 | as the argument. |
| 1058 | |
Scott James Remnant | 8107b44 | 2006-12-05 20:49:36 +0000 | [diff] [blame] | 1059 | * nih/test.h: Include config.h on behalf of the test suites. |
| 1060 | |
Scott James Remnant | 9d4deb3 | 2006-12-05 20:48:53 +0000 | [diff] [blame] | 1061 | * nih/test.h (TEST_EQ_STR, TEST_NE_STR): String comparison tests. |
| 1062 | |
Scott James Remnant | fd51d01 | 2006-12-05 19:59:04 +0000 | [diff] [blame] | 1063 | * nih/test.h (TEST_FAILED): abort is much better than exit |
| 1064 | |
Scott James Remnant | 8884c31 | 2006-12-05 19:11:27 +0000 | [diff] [blame] | 1065 | * nih/test.h (INIT_TEST): Drop this, we'll just return directly. |
| 1066 | (TEST_FAILED): Return directly on failure. |
| 1067 | (CALL_TEST): Drop this again. |
| 1068 | |
Scott James Remnant | d91c313 | 2006-12-05 19:01:26 +0000 | [diff] [blame] | 1069 | * nih/test.h (CALL_TEST): Add "call a function" macro. |
| 1070 | |
Scott James Remnant | 67a9b5c | 2006-12-05 18:58:35 +0000 | [diff] [blame] | 1071 | * nih/test.h: Macros that implement a simple test framework based |
| 1072 | on the patterns I was using anyway. |
| 1073 | * nih/Makefile.am (nihinclude_HEADERS): Install nih/test.h |
| 1074 | |
Scott James Remnant | 83c7786 | 2006-12-05 14:44:47 +0000 | [diff] [blame] | 1075 | * nih/tests/test_command.c (test_parser, test_help): flush stdout |
| 1076 | or stderr before calling dup2(). |
| 1077 | |
Scott James Remnant | 5149f69 | 2006-12-05 14:42:45 +0000 | [diff] [blame] | 1078 | * nih/tests/test_option.c (test_parser, test_version, test_help): |
| 1079 | flush stdout or stderr before calling dup2(). |
| 1080 | |
Scott James Remnant | de99cbb | 2006-12-05 14:40:13 +0000 | [diff] [blame] | 1081 | * nih/tests/test_io.c: Formatting fix. |
| 1082 | |
Scott James Remnant | 10630ad | 2006-12-05 14:38:01 +0000 | [diff] [blame] | 1083 | * nih/file.c (nih_file_map): Tidy up; in particular don't allow |
| 1084 | opening in just write mode, seeing as that doesn't work. |
| 1085 | * nih/tests/test_file.c (test_unmap): Test unmap separately. |
| 1086 | (test_map): Update for new checks. |
| 1087 | |
Scott James Remnant | 73eab77 | 2006-12-05 14:22:15 +0000 | [diff] [blame] | 1088 | * nih/file.c (nih_file_add_watch): No need to set ENOMEM if |
| 1089 | nih_new fails, that will be already set. |
| 1090 | (nih_file_reader): Clarify why nih_io_read must return a pointer. |
| 1091 | |
Scott James Remnant | 6e92788 | 2006-12-05 14:06:04 +0000 | [diff] [blame] | 1092 | * nih/tests/test_string.c (test_str_screen_width) |
| 1093 | (test_str_screen_wrap): flush stdout before calling dup2(). |
| 1094 | |
Scott James Remnant | e5fca7a | 2006-12-05 14:02:18 +0000 | [diff] [blame] | 1095 | * nih/tests/test_main.c (test_suggest_help, test_version): flush |
| 1096 | stdout or stderr before calling dup2(). |
| 1097 | |
Scott James Remnant | f7a83e0 | 2006-12-05 13:59:30 +0000 | [diff] [blame] | 1098 | * nih/tests/test_logging.c (test_logger_printf): flush stdout or |
| 1099 | stderr before calling dup2(), otherwise we don't know which stream |
| 1100 | the buffered output will be going to. |
| 1101 | |
Scott James Remnant | 32965ca | 2006-12-05 13:25:09 +0000 | [diff] [blame] | 1102 | * nih/tests/test_error.c (test_push_context): Check that unhandled |
| 1103 | errors within a context are notified and freed if the context is |
| 1104 | popped. |
| 1105 | |
Scott James Remnant | b862b9a | 2006-12-05 13:11:49 +0000 | [diff] [blame] | 1106 | * nih/alloc.c (nih_alloc_reparent): Function to reparent a pointer |
| 1107 | to a new parent or just orphan it. |
| 1108 | * nih/alloc.h: Update. |
| 1109 | * nih/tests/test_alloc.c (test_reparent): Make sure it works. |
| 1110 | |
Scott James Remnant | 82a3f31 | 2006-12-05 12:48:22 +0000 | [diff] [blame] | 1111 | * nih/tests/test_alloc.c (test_alloc_using): Check that this works |
| 1112 | properly if the allocator returns NULL. |
| 1113 | (test_realloc): A few cases to check here; make sure that it works |
| 1114 | if the pointer to realloc is NULL, actually test the children |
| 1115 | reparenting code here and test the reallocator returning NULL. |
| 1116 | |
Scott James Remnant | afcf58b | 2006-12-05 12:22:33 +0000 | [diff] [blame] | 1117 | * README: Correct typo. |
| 1118 | |
Scott James Remnant | dd9fe39 | 2006-11-12 11:21:00 -0800 | [diff] [blame] | 1119 | 2006-11-12 Scott James Remnant <scott@netsplit.com> |
| 1120 | |
Scott James Remnant | 049d7c9 | 2006-11-12 16:36:40 -0800 | [diff] [blame] | 1121 | * nih/Makefile.am (INCLUDES, DEFS): Drop these two variables |
| 1122 | (AM_CPPFLAGS): in favour of this combined variable. |
| 1123 | |
Scott James Remnant | 12758ed | 2006-11-12 15:48:41 -0800 | [diff] [blame] | 1124 | * configure.ac (AM_INIT_AUTOMAKE): Include nostdinc so we don't get |
| 1125 | Automake's broken default includes. |
| 1126 | * nih/Makefile.am (INCLUDES): Include $top_builddir and $top_srcdir, |
| 1127 | everything else wants relative paths from there. |
| 1128 | (DEFAULT_INCLUDES): Drop override now we don't need it. |
| 1129 | |
Scott James Remnant | dd9fe39 | 2006-11-12 11:21:00 -0800 | [diff] [blame] | 1130 | * m4/compiler.m4 (NIH_C_THREAD): Define a macro in the manner of |
| 1131 | AC_C_CONST that will #define __thread to empty if it isn't supported |
| 1132 | by the compiler. |
| 1133 | * m4/misc.m4 (NIH_INIT): libnih uses __thread. |
| 1134 | |
Scott James Remnant | 3262cee | 2006-10-13 14:25:07 +0100 | [diff] [blame] | 1135 | 2006-10-13 Scott James Remnant <scott@netsplit.com> |
| 1136 | |
| 1137 | * nih/command.h: Adjust type of NihCommandAction to include const. |
| 1138 | * nih/tests/test_command.c (my_action): Update. |
| 1139 | |
Scott James Remnant | b5d843c | 2006-10-12 15:09:15 +0100 | [diff] [blame] | 1140 | 2006-10-12 Scott James Remnant <scott@netsplit.com> |
| 1141 | |
| 1142 | * configure.ac: Expand AC_GNU_SOURCE so we get _GNU_SOURCE and so |
| 1143 | that gettext doesn't complain. |
| 1144 | (AM_GNU_GETTEXT_VERSION): Increase to 0.15 |
| 1145 | (AC_PREREQ): Increase to 2.60 |
| 1146 | * HACKING: Update autoconf and gettext requirements. |
| 1147 | |
Scott James Remnant | 24ba628 | 2006-10-11 11:43:22 +0100 | [diff] [blame] | 1148 | 2006-10-11 Scott James Remnant <scott@netsplit.com> |
| 1149 | |
Scott James Remnant | 297f636 | 2006-10-11 17:36:28 +0100 | [diff] [blame] | 1150 | * nih/string.c (nih_str_screen_wrap): Don't quite fill the screen, |
| 1151 | instead leave a character spare as it looks somehow neater that way. |
| 1152 | * nih/option.c (nih_option_group_help): Likewise. |
| 1153 | * nih/tests/test_string.c (test_str_screen_wrap): Update tests. |
| 1154 | * nih/tests/test_option.c (test_help): Fix wrapping test. |
| 1155 | |
Scott James Remnant | 7674efd | 2006-10-11 16:49:32 +0100 | [diff] [blame] | 1156 | * TODO: Update. |
| 1157 | |
Scott James Remnant | ec11a81 | 2006-10-11 16:44:23 +0100 | [diff] [blame] | 1158 | * nih/command.c: Implement a command parser that uses the first |
| 1159 | non-option argument (or program name) and selects different help |
| 1160 | and options based on that. |
| 1161 | * nih/command.h: Structures and prototypes. |
| 1162 | * nih/libnih.h: Include command.h |
| 1163 | * nih/tests/test_command.c: Test suite for command parser. |
| 1164 | * nih/Makefile.am (libnih_la_SOURCES): Build and link command.c |
| 1165 | (nihinclude_HEADERS): Install command.h |
| 1166 | (TESTS): Build and run command test cases |
| 1167 | (test_command_SOURCES, test_command_LDFLAGS, test_command_LDADD): |
| 1168 | Details for command test suite binary. |
| 1169 | |
Scott James Remnant | a4febfc | 2006-10-11 15:48:30 +0100 | [diff] [blame] | 1170 | * nih/tests/test_option.c: Keep a copy of last_option otherwise |
| 1171 | it's freed while we're not around. |
| 1172 | |
Scott James Remnant | 55a9874 | 2006-10-11 14:09:55 +0100 | [diff] [blame] | 1173 | * nih/option.c (nih_option_set_footer): Add a footer string. |
| 1174 | (nih_option_help): Also add the footer string. |
| 1175 | * nih/option.h: Update. |
| 1176 | * nih/tests/test_option.c (test_help): Check the footer. |
| 1177 | |
Scott James Remnant | 9dfd41d | 2006-10-11 14:00:37 +0100 | [diff] [blame] | 1178 | * nih/option.c (nih_option_set_usage_stem): Add function to set |
| 1179 | the "[OPTION]..." bit of the usage line. |
| 1180 | (nih_option_help): Use the usage stem if set. |
| 1181 | * nih/option.h: Update. |
| 1182 | * nih/tests/test_option.c (test_help): Check the usage stem. |
| 1183 | |
Scott James Remnant | b690259 | 2006-10-11 12:35:24 +0100 | [diff] [blame] | 1184 | * nih/option.c (nih_option_join): Add function to combine two lists |
| 1185 | of options. |
| 1186 | (nih_option_parser): Join the options and default_options lists, |
| 1187 | don't play with arrays of lists. |
| 1188 | (nih_option_get_short, nih_option_get_long): Simply by just iterating |
| 1189 | the one array. |
| 1190 | (nih_option_help, nih_option_group_help): Again simply by just |
| 1191 | iterating the one array. |
| 1192 | * nih/option.h: Update. |
| 1193 | * nih/tests/test_option.c (test_parser): Don't check addresses of |
| 1194 | options as they've moved. |
| 1195 | |
Scott James Remnant | cf9d1bd | 2006-10-11 11:48:33 +0100 | [diff] [blame] | 1196 | * nih/option.c (nih_option_set_usage, nih_option_set_synopsis) |
| 1197 | (nih_option_set_help): Allow NULL to be set to override existing |
| 1198 | strings. |
| 1199 | |
Scott James Remnant | 24ba628 | 2006-10-11 11:43:22 +0100 | [diff] [blame] | 1200 | * nih/option.c (nih_option_help): Make static. |
| 1201 | * nih/option.h: Update. |
| 1202 | |
Scott James Remnant | 4889094 | 2006-10-10 12:28:39 +0100 | [diff] [blame] | 1203 | 2006-10-10 Scott James Remnant <scott@netsplit.com> |
| 1204 | |
Scott James Remnant | 28a55e9 | 2006-10-10 18:29:29 +0100 | [diff] [blame] | 1205 | * TODO: Update. |
| 1206 | |
Scott James Remnant | 6b000dd | 2006-10-10 18:29:11 +0100 | [diff] [blame] | 1207 | * nih/option.c (nih_option_group_help): Use a factor of the screen |
| 1208 | width when formatting help options, but keep at least 20 chars |
| 1209 | visible at all times. |
| 1210 | |
Scott James Remnant | 9a19664 | 2006-10-10 18:24:37 +0100 | [diff] [blame] | 1211 | * nih/string.c (nih_str_screen_width): Add function to return just |
| 1212 | the screen width. |
| 1213 | (nih_str_screen_wrap): Use that function. |
| 1214 | * nih/string.h: Update. |
| 1215 | * nih/tests/test_string.c (test_str_screen_width): Check function. |
| 1216 | |
Scott James Remnant | d1342ff | 2006-10-10 18:10:48 +0100 | [diff] [blame] | 1217 | * nih/option.c (nih_option_set_synopsis): Function to set a synopsis |
| 1218 | string that follows the usage. |
| 1219 | (nih_option_set_help): Function to set the help string that follows |
| 1220 | the options. |
| 1221 | (nih_option_help): Output synopsis and help strings. |
| 1222 | * nih/option.h: Update. |
| 1223 | * nih/tests/test_option.c (test_help): Check behaviour |
| 1224 | |
Scott James Remnant | 110e57a | 2006-10-10 17:42:58 +0100 | [diff] [blame] | 1225 | * TODO: Update. |
| 1226 | |
Scott James Remnant | 34caaa3 | 2006-10-10 17:35:07 +0100 | [diff] [blame] | 1227 | * nih/main.c (nih_main_version): Use nih_str_screen_wrap to output |
| 1228 | the GPL preamble bit. |
| 1229 | * nih/tests/test_main.c (test_version): Unset COLUMNS just in case. |
| 1230 | |
Scott James Remnant | d264458 | 2006-10-10 17:29:15 +0100 | [diff] [blame] | 1231 | * nih/string.c (nih_str_screen_wrap): Add wrapper around |
| 1232 | nih_str_wrap that obtains the screen width and uses that for len. |
| 1233 | * nih/string.h: Add prototype. |
| 1234 | * nih/tests/test_string.c (test_str_screen_wrap): Test new function. |
| 1235 | * nih/Makefile.am (test_string_LDADD): Link with -lutil so we can |
| 1236 | use openpty in our "fake terminal" tests. |
| 1237 | |
Scott James Remnant | 1f880f2 | 2006-10-10 16:52:46 +0100 | [diff] [blame] | 1238 | * nih/tests/test_option.c: Fix minor test case memory leak. |
| 1239 | |
Scott James Remnant | 981fa8e | 2006-10-10 16:48:32 +0100 | [diff] [blame] | 1240 | * nih/tests/test_child.c (test_poll, test_poll): Use better |
| 1241 | interlocks then usleep. |
| 1242 | |
Scott James Remnant | 5fadcfa | 2006-10-10 16:42:44 +0100 | [diff] [blame] | 1243 | * nih/tests/test_option.c (main): Enable test of --debug, oops. |
| 1244 | |
Scott James Remnant | ad5cc38 | 2006-10-10 16:39:39 +0100 | [diff] [blame] | 1245 | * nih/main.c (nih_main_daemonise): Document why this is better than |
| 1246 | daemon(), and thus not nih. |
| 1247 | * nih/tests/test_main.c (test_daemonise): Test the daemonise |
| 1248 | function works properly. |
| 1249 | |
Scott James Remnant | 1e5829a | 2006-10-10 15:53:13 +0100 | [diff] [blame] | 1250 | * nih/timer.h: Fix comments. |
| 1251 | |
| 1252 | * nih/hash.c (nih_hash_new): This needs a parent pointer too. |
| 1253 | * nih/hash.h: Update prototype. |
| 1254 | * nih/tests/test_hash.c: Update test cases. |
| 1255 | |
Scott James Remnant | 6a8ebf6 | 2006-10-10 15:42:23 +0100 | [diff] [blame] | 1256 | * nih/child.c: Clarify child_watches item types. |
| 1257 | * nih/file.c: Clarify file_watches item types. |
| 1258 | * nih/io.c: Clarify io_watches item types. |
| 1259 | * nih/main.c: Clarify loop_functions item types. |
| 1260 | * nih/timer.c: Clarify timers item types. |
| 1261 | |
Scott James Remnant | 65f621b | 2006-10-10 15:39:57 +0100 | [diff] [blame] | 1262 | * nih/signal.h (NihSignalCb): Rename to NihSignalHandler. |
| 1263 | (NihSignal): Change callback name to handler and type |
| 1264 | to NihSignalHandler. |
| 1265 | * nih/signal.c (nih_signal_add_callback): Rename to |
| 1266 | nih_signal_add_handler. |
| 1267 | * nih/tests/test_signal.c: Update. |
| 1268 | |
Scott James Remnant | 602eda4 | 2006-10-10 15:33:56 +0100 | [diff] [blame] | 1269 | * nih/list.c (nih_list_new): Take a parent pointer like everything |
| 1270 | else, showing its age slightly. |
| 1271 | * nih/list.h: Update prototype. |
| 1272 | * nih/tests/test_list.c: Update test cases. |
| 1273 | * nih/child.c (nih_child_init): Pass NULL to nih_list_new(). |
| 1274 | * nih/error.c (nih_error_init): Pass NULL to nih_list_new(). |
| 1275 | * nih/file.c (nih_file_init): Pass NULL to nih_list_new(). |
| 1276 | * nih/io.c (nih_io_init): Pass NULL to nih_list_new(). |
| 1277 | * nih/main.c (nih_main_loop_init): Pass NULL to nih_list_new(). |
| 1278 | * nih/signal.c (nih_signal_init): Pass NULL to nih_list_new(). |
| 1279 | * nih/timer.c (nih_timer_init): Pass NULL to nih_list_new(). |
| 1280 | * nih/tests/test_hash.c: Pass NULL to nih_list_new(). |
| 1281 | |
Scott James Remnant | 9180a36 | 2006-10-10 15:29:05 +0100 | [diff] [blame] | 1282 | * nih/alloc.c, nih/alloc.h, nih/child.c, nih/child.h, nih/error.c, |
| 1283 | nih/error.h, nih/file.c, nih/file.h, nih/hash.c, nih/hash.h, |
| 1284 | nih/io.c, nih/io.h, nih/list.c, nih/list.h, nih/main.c, nih/main.h, |
| 1285 | nih/option.c, nih/option.h, nih/signal.c, nih/signal.h, nih/string.c, |
| 1286 | nih/string.h, nih/timer.c, nih/timer.h: Clean up documentation and |
| 1287 | parent return values. |
| 1288 | |
Scott James Remnant | 32682c8 | 2006-10-10 14:42:20 +0100 | [diff] [blame] | 1289 | * HACKING: Detail function documentation requirement and format. |
| 1290 | |
Scott James Remnant | 4889094 | 2006-10-10 12:28:39 +0100 | [diff] [blame] | 1291 | * nih/tests/test_signal.c (test_set_default, test_set_ignore) |
| 1292 | (test_reset): amd64 seems to set the SA_NODEFER flag even when |
| 1293 | you pass zero, so just check we clear important bits. |
| 1294 | |
Scott James Remnant | c945ac6 | 2006-09-27 21:24:37 +0100 | [diff] [blame] | 1295 | 2006-09-27 Scott James Remnant <scott@netsplit.com> |
| 1296 | |
| 1297 | * m4/misc.m4 (NIH_INIT): Add easier macro for using libnih. |
| 1298 | * m4/compiler.m4: Remove hack to include misc.m4 |
| 1299 | * configure.ac: Drop the macro set and replace with NIH_INIT |
| 1300 | * README: Update. |
| 1301 | * nihify: Warn if NIH_INIT not present. |
| 1302 | |
Scott James Remnant | a20ab6d | 2006-09-25 21:57:30 +0100 | [diff] [blame] | 1303 | 2006-09-25 Scott James Remnant <scott@netsplit.com> |
| 1304 | |
Scott James Remnant | 0138942 | 2006-09-25 21:59:00 +0100 | [diff] [blame] | 1305 | * TODO (main): Update. |
| 1306 | |
Scott James Remnant | a20ab6d | 2006-09-25 21:57:30 +0100 | [diff] [blame] | 1307 | * nih/logging.h (nih_message): Add nih_message as an alias for |
| 1308 | nih_warn. |
| 1309 | * nih/tests/test_logging.c (test_log_message): Check new macro. |
| 1310 | |
Scott James Remnant | 3cdf5c5 | 2006-09-20 04:28:07 +0100 | [diff] [blame] | 1311 | 2006-09-20 Michael Biebl <mbiebl@gmail.com> |
| 1312 | |
| 1313 | * nih/tests/test_file.c: Include nih/inotify.h when sys/inotify.h |
| 1314 | is not available. |
| 1315 | |
Scott James Remnant | 4f65422 | 2006-09-19 17:54:11 +0100 | [diff] [blame] | 1316 | 2006-09-19 Michael Biebl <mbiebl@gmail.com> |
| 1317 | |
| 1318 | * nih/Makefile.am (nihinclude_HEADERS): Install inotify.h just in |
| 1319 | case it's required |
| 1320 | |
Scott James Remnant | a8530bb | 2006-09-18 19:41:39 +0100 | [diff] [blame] | 1321 | 2006-09-18 Michael Biebl <mbiebl@gmail.com> |
| 1322 | |
| 1323 | * configure.ac: Check for sys/inotify.h |
| 1324 | * nih/inotify.h: Taken from udev, this defines the syscalls |
| 1325 | and flags, etc. for inotify on glibc 2.3 |
| 1326 | * nih/file.c, nih/file.h: Include nih/inotify.h if we do not have |
| 1327 | sys/inotify.h |
| 1328 | |
Scott James Remnant | c347726 | 2006-09-13 16:54:49 +0100 | [diff] [blame] | 1329 | 2006-09-13 Scott James Remnant <scott@netsplit.com> |
| 1330 | |
| 1331 | * nih/child.c (nih_child_poll): Zero the siginfo_t struct before |
| 1332 | every call to waitid(), the kernel doesn't do it for us when |
| 1333 | running the compat syscall (but does for the native one *sigh). |
| 1334 | |
Scott James Remnant | 2e513b6 | 2006-09-08 03:39:18 +0100 | [diff] [blame] | 1335 | 2006-09-08 Scott James Remnant <scott@netsplit.com> |
| 1336 | |
Scott James Remnant | 24865e3 | 2006-09-08 17:50:11 +0100 | [diff] [blame] | 1337 | * TODO: Update. |
| 1338 | |
Scott James Remnant | 29910f9 | 2006-09-08 03:49:20 +0100 | [diff] [blame] | 1339 | * nih/option.c (nih_option_help): Allow the usage string to be |
| 1340 | customised. |
| 1341 | (nih_option_set_usage): Using this function. |
| 1342 | * nih/option.h: Update. |
| 1343 | * nih/tests/test_option.c (test_help): Test the usage string. |
| 1344 | |
Scott James Remnant | 7f9a436 | 2006-09-08 03:42:45 +0100 | [diff] [blame] | 1345 | * nih/main.c (nih_main_daemonise): Use program_name for the pid file. |
| 1346 | * nih/main.h: Update. |
| 1347 | |
Scott James Remnant | 2e513b6 | 2006-09-08 03:39:18 +0100 | [diff] [blame] | 1348 | * nih/main.c (nih_main_daemonise): Add a daemonise function, |
| 1349 | pretty standard really. |
| 1350 | * nih/main.h: Update. |
| 1351 | |
Scott James Remnant | 1f38a00 | 2006-09-07 21:26:09 +0100 | [diff] [blame] | 1352 | 2006-09-07 Scott James Remnant <scott@netsplit.com> |
| 1353 | |
| 1354 | * AUTHORS: Mention the ChangeLog file. |
| 1355 | |
Scott James Remnant | 1725236 | 2006-09-04 07:15:40 +0100 | [diff] [blame] | 1356 | 2006-09-04 Scott James Remnant <scott@netsplit.com> |
| 1357 | |
Scott James Remnant | 4dc1674 | 2006-09-04 07:46:00 +0100 | [diff] [blame] | 1358 | * README: Add some documentation for the curious. |
| 1359 | |
Scott James Remnant | 1c7d2df | 2006-09-04 07:25:17 +0100 | [diff] [blame] | 1360 | * nih/file.c (nih_file_add_watch): Set nih_file_remove_watch as |
| 1361 | the default destructor so that nih_free can be called or work in |
| 1362 | a tree. |
| 1363 | (nih_file_remove_watch): Modify to not call nih_free and work if |
| 1364 | called multiple times. |
| 1365 | |
Scott James Remnant | f81341b | 2006-09-04 07:18:08 +0100 | [diff] [blame] | 1366 | * nih/signal.c (nih_signal_set_default, nih_signal_set_ignore): |
| 1367 | Set flags to zero when defaulting or ignoring signals. |
| 1368 | * nih/tests/test_signal.c (test_set_default, test_set_ignore) |
| 1369 | (test_reset): Modify test cases appropriately. |
| 1370 | |
Scott James Remnant | 1725236 | 2006-09-04 07:15:40 +0100 | [diff] [blame] | 1371 | * nih/hash.h: Add missing attribute for nih_hash_new |
| 1372 | * nih/list.h: Add missing attribute for nih_list_new |
| 1373 | |
Scott James Remnant | 8f7df05 | 2006-09-01 19:47:47 +0100 | [diff] [blame] | 1374 | 2006-09-01 Scott James Remnant <scott@netsplit.com> |
| 1375 | |
| 1376 | * nih/option.c (nih_option_group_help): Cast linelen to not induce |
| 1377 | a warning. |
| 1378 | |
Scott James Remnant | 133ff0e | 2006-08-31 02:01:57 +0100 | [diff] [blame] | 1379 | 2006-08-31 Scott James Remnant <scott@netsplit.com> |
| 1380 | |
Scott James Remnant | 4816f9a | 2006-09-01 03:07:51 +0100 | [diff] [blame] | 1381 | * nih/main.c (nih_main_loop_interrupt): Always initialise the |
| 1382 | interrupt pipe. |
| 1383 | (nih_main_loop_init): Move interrupt pipe initialisation to here |
| 1384 | so that it's always available. |
| 1385 | (nih_main_loop): Drop the extra call to nih_signal_poll(). |
| 1386 | |
Scott James Remnant | 420cffe | 2006-08-31 23:50:46 +0100 | [diff] [blame] | 1387 | * nih/option.c (nih_option_get_short, nih_option_get_long): Allow |
| 1388 | catch-all options. |
| 1389 | * nih/tests/test_option.c (test_parser): Test catch-all options. |
| 1390 | |
Scott James Remnant | 4593ff2 | 2006-08-31 18:57:06 +0100 | [diff] [blame] | 1391 | * TODO: Update. |
| 1392 | |
Scott James Remnant | 133ff0e | 2006-08-31 02:01:57 +0100 | [diff] [blame] | 1393 | * nih/option.c (nih_option_handle_arg): Free any existing option |
| 1394 | value. |
| 1395 | |
Scott James Remnant | 5b5c2e0 | 2006-08-30 01:57:36 +0100 | [diff] [blame] | 1396 | 2006-08-30 Scott James Remnant <scott@netsplit.com> |
| 1397 | |
Scott James Remnant | 99dada9 | 2006-08-30 16:12:47 +0100 | [diff] [blame] | 1398 | * nih/option.c (nih_option_debug): Add a hidden --debug option that |
| 1399 | sets the logging level up really high. |
| 1400 | (nih_option_handle): Just compare the names rather than offset |
| 1401 | within a list that can change. |
| 1402 | * nih/option.h: Update. |
| 1403 | * nih/tests/test_option.c (test_debug): Check that it works. |
| 1404 | |
Scott James Remnant | aa35203 | 2006-08-30 02:05:40 +0100 | [diff] [blame] | 1405 | * nih/option.c (nih_option_group_help): Output "Options" where we |
| 1406 | only have the one group. |
| 1407 | |
Scott James Remnant | 5b5c2e0 | 2006-08-30 01:57:36 +0100 | [diff] [blame] | 1408 | * nih/option.c (nih_option_group_help): Don't output options without |
| 1409 | help strings. |
| 1410 | * nih/tests/test_option.c (test_help): Update. |
| 1411 | |
Scott James Remnant | c3aaba8 | 2006-08-25 14:41:29 +0200 | [diff] [blame] | 1412 | 2006-08-25 Scott James Remnant <scott@netsplit.com> |
| 1413 | |
| 1414 | * nih/io.c (nih_io_watcher): Clean up the handling of the out of |
| 1415 | memory condition while extending the buffer so that we just return |
| 1416 | to be called again rather than end up performing some random action. |
| 1417 | |
Scott James Remnant | 59f3e4f | 2006-08-24 02:23:24 +0200 | [diff] [blame] | 1418 | 2006-08-24 Scott James Remnant <scott@netsplit.com> |
| 1419 | |
Scott James Remnant | 4ff39ce | 2006-08-24 02:53:51 +0200 | [diff] [blame] | 1420 | * nihify (src_dir): Also copy m4/Makefile.am |
| 1421 | |
Scott James Remnant | 55a481d | 2006-08-24 02:31:01 +0200 | [diff] [blame] | 1422 | * nih/file.c (nih_file_remove_watch): Raise the error before |
| 1423 | performing other actions so errno is not lost. |
| 1424 | |
Scott James Remnant | 0a63a3d | 2006-08-24 02:23:48 +0200 | [diff] [blame] | 1425 | * nih/io.c (nih_io_watcher): Fix a pretty critical bug, we weren't |
| 1426 | saving the value of errno so it was usually zero by the time we |
| 1427 | looked at it. |
| 1428 | |
Scott James Remnant | 59f3e4f | 2006-08-24 02:23:24 +0200 | [diff] [blame] | 1429 | * nih/logging.c (nih_logger_syslog): Useful alternative to |
| 1430 | nih_logger_printf. |
| 1431 | * nih/logging.h: Update. |
| 1432 | |
Scott James Remnant | 377333d | 2006-08-23 19:47:28 +0200 | [diff] [blame] | 1433 | 2006-08-23 Scott James Remnant <scott@netsplit.com> |
| 1434 | |
Scott James Remnant | 1997231 | 2006-08-23 21:55:49 +0200 | [diff] [blame] | 1435 | * nih/tests/test_string.c: Add missing free calls. |
| 1436 | |
Scott James Remnant | 61e4547 | 2006-08-23 21:51:33 +0200 | [diff] [blame] | 1437 | * nih/tests/test_io.c (test_watcher): Silence the error message. |
| 1438 | * nih/tests/test_option.c (test_parser): Add some forgotten calls |
| 1439 | to nih_free |
| 1440 | |
Scott James Remnant | 94e3768 | 2006-08-23 21:43:41 +0200 | [diff] [blame] | 1441 | * nih/main.c (nih_main_init_full): Free the package string when |
| 1442 | overwriting it. |
| 1443 | |
Scott James Remnant | a82b009 | 2006-08-23 21:39:00 +0200 | [diff] [blame] | 1444 | * nih/tests/test_logging.c: Keep a copy of the last message |
| 1445 | otherwise we're reading free'd memory (again). |
| 1446 | |
Scott James Remnant | f8880bb | 2006-08-23 21:34:20 +0200 | [diff] [blame] | 1447 | * nih/tests/test_list.c: Memory cleanups. |
| 1448 | |
Scott James Remnant | 5bc4691 | 2006-08-23 21:30:12 +0200 | [diff] [blame] | 1449 | * nih/signal.c (nih_signal_set_default, nih_signal_set_ignore): |
| 1450 | Don't initialise the signals list, there's no need. |
| 1451 | |
Scott James Remnant | a26ebc2 | 2006-08-23 20:47:20 +0200 | [diff] [blame] | 1452 | * nih/tests/test_hash.c: Various missing calls to nih_free. |
| 1453 | |
Scott James Remnant | 0344eb4 | 2006-08-23 20:41:11 +0200 | [diff] [blame] | 1454 | * nih/file.c (nih_file_remove_watch): Fix another wrong call to |
| 1455 | nih_free. |
| 1456 | |
Scott James Remnant | e5f85e3 | 2006-08-23 20:33:34 +0200 | [diff] [blame] | 1457 | * nih/tests/test_child.c (test_poll): Free the watcher. |
| 1458 | |
Scott James Remnant | c391227 | 2006-08-23 20:26:39 +0200 | [diff] [blame] | 1459 | * nih/file.c (nih_file_remove_watch): Remove from the containing |
| 1460 | list before freeing. |
| 1461 | * nih/tests/test_file.c (my_watcher): Make sure we copy the name |
| 1462 | as it will be freed by the time we get back to the test. |
| 1463 | |
Scott James Remnant | b5f985a | 2006-08-23 20:21:39 +0200 | [diff] [blame] | 1464 | * nih/list.c (nih_list_free): Don't throw away the destructor |
| 1465 | return value. |
| 1466 | |
Scott James Remnant | a790a31 | 2006-08-23 20:01:04 +0200 | [diff] [blame] | 1467 | * nih/tests/test_error.c: Further missing calls to nih_free |
| 1468 | |
Scott James Remnant | 85f1047 | 2006-08-23 19:56:34 +0200 | [diff] [blame] | 1469 | * nih/tests/test_alloc.c: Correct a few missing nih_free's |
| 1470 | |
Scott James Remnant | 377333d | 2006-08-23 19:47:28 +0200 | [diff] [blame] | 1471 | * nih/file.c (nih_file_map): Correct a thinko, have to mask |
| 1472 | flags by O_ACCMODE and compare for equality to extract the open |
| 1473 | access mode. |
| 1474 | |
Scott James Remnant | ecce628 | 2006-08-22 12:23:07 +0200 | [diff] [blame] | 1475 | 2006-08-22 Scott James Remnant <scott@netsplit.com> |
| 1476 | |
| 1477 | * nih/file.c (nih_file_map, nih_file_unmap): Add an easier to use |
| 1478 | wrapper around mmap() when we just want the file in memory. |
| 1479 | * nih/file.h: Add prototypes. |
| 1480 | * nih/tests/test_file.c (test_map): Test the functions. |
| 1481 | |
Scott James Remnant | 097a7e1 | 2006-08-21 01:25:23 +0200 | [diff] [blame] | 1482 | 2006-08-21 Scott James Remnant <scott@netsplit.com> |
| 1483 | |
| 1484 | * nih/file.c: Wrap the inotify syscalls with something a little |
| 1485 | friendlier to deal with. |
| 1486 | * nih/file.h: Typedefs, structures and prototypes. |
| 1487 | * nih/libnih.h: Include file.h |
| 1488 | * nih/io.h: Correct typo in argument name. |
| 1489 | * nih/Makefile.am (libnih_la_SOURCES): Build and link file.c |
| 1490 | (nihinclude_HEADERS): Install file.h |
| 1491 | (TESTS): Build and run file test cases |
| 1492 | (test_file_SOURCES, test_file_LDFLAGS, test_file_LDADD): Details |
| 1493 | for file test case binary |
| 1494 | |
Scott James Remnant | 0cf12e8 | 2006-08-19 17:41:41 +0100 | [diff] [blame] | 1495 | 2006-08-19 Scott James Remnant <scott@netsplit.com> |
| 1496 | |
Scott James Remnant | abcffd8 | 2006-08-19 19:10:02 +0100 | [diff] [blame] | 1497 | * nih/option.c (nih_option_parser): Finish option processing when |
| 1498 | the first non-option argument is found (command-mode) |
| 1499 | * nih/option.h: Update. |
| 1500 | * nih/tests/test_option.c (test_parser): Test command-mode. |
| 1501 | |
Scott James Remnant | 4dcce34 | 2006-08-19 18:59:07 +0100 | [diff] [blame] | 1502 | * nih/option.c: Implement a simple, yet flexible option parser. |
| 1503 | * nih/option.h: Typedefs, structures and prototypes. |
| 1504 | * nih/libnih.h: Include option.h |
| 1505 | * nih/tests/test_option.c: Test it all pretty thoroughly. |
| 1506 | * nih/Makefile.am (libnih_la_SOURCES): Build and link option.c |
| 1507 | (nihinclude_HEADERS): Install option.h |
| 1508 | (TESTS): Run the option test cases |
| 1509 | (test_option_SOURCES, test_option_LDFLAGS, test_option_LDADD): |
| 1510 | Details for the option test case binary. |
| 1511 | * TODO: Update. |
| 1512 | |
Scott James Remnant | 0cf12e8 | 2006-08-19 17:41:41 +0100 | [diff] [blame] | 1513 | * nih/string.c (nih_str_wrap): Implement a function to wrap a |
| 1514 | string into the desired number of characters wide. |
| 1515 | * nih/string.h: Update. |
| 1516 | * nih/tests/test_string.c (test_str_wrap): Test the new function |
| 1517 | to make sure it does the right things. |
| 1518 | |
Scott James Remnant | 13b0e07 | 2006-08-18 18:50:11 +0100 | [diff] [blame] | 1519 | 2006-08-18 Scott James Remnant <scott@netsplit.com> |
| 1520 | |
Scott James Remnant | 293072c | 2006-08-18 20:37:51 +0100 | [diff] [blame] | 1521 | * TODO: Update. |
| 1522 | |
Scott James Remnant | 034abdf | 2006-08-18 20:36:40 +0100 | [diff] [blame] | 1523 | * nih/main.h (nih_main_init_gettext): Macro that expands to the |
| 1524 | usual gettext initialisation spiel if ENABLE_NLS is set, or nothing |
| 1525 | if not. |
| 1526 | (nih_main_init): Expand nih_main_init_gettext as well, we almost |
| 1527 | always want to do that, after all. |
| 1528 | * nih/macros.h: Include locale.h if ENABLE_NLS is set, as that |
| 1529 | contains setlocale, amongst other things. |
| 1530 | * nih/tests/test_main.c (test_init_gettext): Check the macro does |
| 1531 | the right things. |
| 1532 | |
Scott James Remnant | 104d3dc | 2006-08-18 19:48:17 +0100 | [diff] [blame] | 1533 | * nih/io.h (NihIoCb): Rename to NihIoWatcher. |
| 1534 | (NihIoReadCb): Rename to NihIoReader. |
| 1535 | (NihIoCloseCb): Rename to NihIoCloseHandler. |
| 1536 | (NihIoErrorCb): Rename to NihIoErrorHandler. |
| 1537 | (NihIoWatch): Rename callback member to watcher. |
| 1538 | (NihIo): Rename read_cb member to reader, close_cb member to |
| 1539 | close_handler and error_cb member to error_handler. |
| 1540 | * nih/io.c: Update to use new names. |
| 1541 | (nih_io_cb): Rename to nih_io_watcher. |
| 1542 | * nih/tests/test_io.c: Update to use new names. |
| 1543 | |
Scott James Remnant | 13b0e07 | 2006-08-18 18:50:11 +0100 | [diff] [blame] | 1544 | * TODO: Update. |
| 1545 | |
Scott James Remnant | eeaebb6 | 2006-08-16 00:49:21 +0100 | [diff] [blame] | 1546 | 2006-08-16 Scott James Remnant <scott@netsplit.com> |
| 1547 | |
Scott James Remnant | 10a9f97 | 2006-08-16 16:49:38 +0100 | [diff] [blame] | 1548 | * nih/main.c (nih_main_loop_add_func): Add a loop function |
| 1549 | (nih_main_loop): Run the loop functions. |
| 1550 | * nih/main.h (NihMainLoopCb, NihMainLoopFunc): Typedefs and |
| 1551 | structures for main loop callbacks. |
| 1552 | * nih/tests/test_main.c (test_main_loop_add_func): Check that |
| 1553 | the loop function is allocated correctly. |
| 1554 | (test_main_loop): Make sure it actually gets called. |
| 1555 | |
Scott James Remnant | c469755 | 2006-08-16 03:56:22 +0100 | [diff] [blame] | 1556 | * nih/io.c (nih_io_cb): Add a couple of check assertions. |
| 1557 | |
Scott James Remnant | eeaebb6 | 2006-08-16 00:49:21 +0100 | [diff] [blame] | 1558 | * nih/macros.h (N_): Should be defined to be a no-op. |
| 1559 | |
Scott James Remnant | 5cabc80 | 2006-08-14 00:16:18 +0100 | [diff] [blame] | 1560 | 2006-08-14 Scott James Remnant <scott@netsplit.com> |
| 1561 | |
Scott James Remnant | a3b7769 | 2006-08-14 21:10:57 +0100 | [diff] [blame] | 1562 | * nih/alloc.c (nih_realloc): Yet another fix to realloc, we |
| 1563 | forgot to reinitialise our entry in the parent's children list in |
| 1564 | the case of no parent. After fixing this and tracing the code, I |
| 1565 | realised that the previous fix was inelegant and there is a way to |
| 1566 | deal with children without modifying the pointers until after the |
| 1567 | reallocation. Documented the reasoning in the function. |
| 1568 | |
Scott James Remnant | 5cabc80 | 2006-08-14 00:16:18 +0100 | [diff] [blame] | 1569 | * nih/io.c (nih_io_reopen): Report on the error rather than just |
| 1570 | suppressing it. |
| 1571 | (nih_io_error): Likewise, report on the error. |
| 1572 | |
Scott James Remnant | f2642c4 | 2006-08-12 00:50:21 +0100 | [diff] [blame] | 1573 | 2006-08-12 Scott James Remnant <scott@netsplit.com> |
| 1574 | |
Scott James Remnant | f0766ce | 2006-08-12 19:41:55 +0100 | [diff] [blame] | 1575 | * nih/main.c (nih_main_loop_close): Drop this function |
| 1576 | (nih_main_loop): Instead mark them close on exec. |
| 1577 | * nih/main.h: Update. |
| 1578 | |
Scott James Remnant | f0857b0 | 2006-08-12 19:37:47 +0100 | [diff] [blame] | 1579 | * nih/main.c (nih_main_loop): Change the main loop to use select |
| 1580 | instead of poll, as its semantics are a lot easier to deal with. |
| 1581 | We also use allow select to be interrupted by writing to a pipe |
| 1582 | from the signal handlers, for when Linux gets around to supporting |
| 1583 | SA_RESTART properly. |
| 1584 | (nih_main_loop_interrupt): Write to the pipe so the select call gets |
| 1585 | interrupted. |
| 1586 | (nih_main_loop_exit): Interrupt the main loop, in case we're |
| 1587 | waiting forever. |
| 1588 | (nih_main_loop_close): Close the interrupt pipe, used in children. |
| 1589 | * nih/main.h: Update. |
| 1590 | * nih/io.c (nih_io_add_watch): Change type of events parameter. |
| 1591 | (nih_io_poll_fds): Remove this function. |
| 1592 | (nih_io_select_fds): And replace with this that sets the select |
| 1593 | file descriptor sets instead. |
| 1594 | (nih_io_handle_fds): Now receives select file descriptor sets, and |
| 1595 | becomes rather more obvious in the process. Restore the previous |
| 1596 | behaviour where a callback isn't called unless requests events |
| 1597 | occur. |
| 1598 | (nih_io_reopen): Always poll for reading so we pick up errors. |
| 1599 | (nih_io_cb): Change type of events parameter and events settings. |
| 1600 | (nih_io_write): Change event settings. |
| 1601 | * nih/io.h: Update. |
| 1602 | (NihIoEvents): replace the previous poll events with a new enum. |
| 1603 | * nih/signal.c (nih_signal_handler): Interrupt the select call in |
| 1604 | the main loop. |
| 1605 | * nih/tests/test_io.c: Update with new test cases. |
| 1606 | * nih/tests/test_child.c: Use select() rather than poll() |
| 1607 | |
Scott James Remnant | f6bc0c5 | 2006-08-12 14:48:57 +0100 | [diff] [blame] | 1608 | * nih/tests/test_io.c (test_buffer_push, test_write): Correct |
| 1609 | uninitialised return value. |
| 1610 | |
Scott James Remnant | 1e6b91b | 2006-08-12 02:26:28 +0100 | [diff] [blame] | 1611 | * nih/main.c (nih_main_loop): Correct a memory leak, we forgot |
| 1612 | to clean up the poll fds list. |
| 1613 | |
Scott James Remnant | f75da13 | 2006-08-12 01:58:37 +0100 | [diff] [blame] | 1614 | * nih/io.c (nih_io_handle_fds): Always call the callback, even if |
| 1615 | unexpected events happen, otherwise we'll miss ERR, HUP, etc. |
| 1616 | (nih_io_shutdown): Allow a socket to be closed lazily, so we can |
| 1617 | send (or receive) a whole bunch of stuff and expect the structure to |
| 1618 | go away afterwards. |
| 1619 | (nih_io_cb): If the shutdown flag has been marked and we run out |
| 1620 | of things in either buffer, act as if one end was closed. |
| 1621 | (nih_io_reopen): Mark sockets as not shutdown by default. |
| 1622 | * nih/io.h: Update. |
| 1623 | * nih/tests/test_io.c (test_shutdown): Test behaviour. |
| 1624 | (test_handle_fds): Take out some of the tests due to changed |
| 1625 | behaviour. While "clever" I think overall this is undesirable. |
| 1626 | |
Scott James Remnant | f2642c4 | 2006-08-12 00:50:21 +0100 | [diff] [blame] | 1627 | * nih/io.c (nih_io_set_cloexec): Function to set the FD_CLOEXEC flag. |
| 1628 | * nih/io.h: Update. |
| 1629 | * nih/tests/test_io.c (test_set_cloexec): Test the function. |
| 1630 | |
Scott James Remnant | 60d62fb | 2006-08-11 23:03:39 +0100 | [diff] [blame] | 1631 | 2006-08-11 Scott James Remnant <scott@netsplit.com> |
| 1632 | |
Scott James Remnant | af2d3b5 | 2006-08-11 23:08:24 +0100 | [diff] [blame] | 1633 | * nih/alloc.h, nih/child.h, nih/hash.h, nih/logging.h, nih/signal.h, |
| 1634 | nih/timer.h: Document arguments to function pointers. |
| 1635 | |
Scott James Remnant | 60d62fb | 2006-08-11 23:03:39 +0100 | [diff] [blame] | 1636 | * nih/io.c: Add a whole bunch of code to provide us with a high- |
| 1637 | throughput, async file/socket layer; largely copied from the |
| 1638 | dircproxy code (well, it works!). This allows read and write calls |
| 1639 | to happen inside the main loop based on whenever poll thinks either |
| 1640 | is possible, while user space can just write what it likes or get |
| 1641 | called when there's data in the recv buffer. |
| 1642 | * nih/io.h: Add the new typedefs, structures and prototypes. |
| 1643 | * nih/tests/test_io.c: Lots of test cases for this stuff. |
| 1644 | |
Scott James Remnant | edc0579 | 2006-08-10 03:12:48 +0100 | [diff] [blame] | 1645 | 2006-08-10 Scott James Remnant <scott@netsplit.com> |
| 1646 | |
Scott James Remnant | 3cbb3a1 | 2006-08-10 03:28:32 +0100 | [diff] [blame] | 1647 | * nih/alloc.c (nih_realloc): Fix a fairly critical bug, we weren't |
| 1648 | dealing with the fact that the children list head can move; |
| 1649 | do some fancy shifting to make that work. |
| 1650 | |
Scott James Remnant | edc0579 | 2006-08-10 03:12:48 +0100 | [diff] [blame] | 1651 | * nih/string.c (nih_str_split): Add a function to split a string |
| 1652 | based on delimiters into an array. |
| 1653 | * nih/string.h: Update. |
| 1654 | * nih/tests/test_string.c (test_str_split): Test the new function. |
| 1655 | |
Scott James Remnant | 5ae01a9 | 2006-08-09 17:48:05 +0100 | [diff] [blame] | 1656 | 2006-08-09 Scott James Remnant <scott@netsplit.com> |
| 1657 | |
Scott James Remnant | 61edf23 | 2006-08-09 17:48:15 +0100 | [diff] [blame] | 1658 | * nih/tests/test_child.c (test_poll): Add extra sleep calls for |
| 1659 | safety. |
| 1660 | |
Scott James Remnant | 5ae01a9 | 2006-08-09 17:48:05 +0100 | [diff] [blame] | 1661 | * nih/libnih.h: Include errors.h |
| 1662 | |
Scott James Remnant | a984d77 | 2006-08-04 05:29:36 +0100 | [diff] [blame] | 1663 | 2006-08-04 Scott James Remnant <scott@netsplit.com> |
| 1664 | |
| 1665 | * nih/errors.h: Include errno.h for helpfulness. |
| 1666 | |
Scott James Remnant | 76fb5ab | 2006-08-03 19:12:48 +0100 | [diff] [blame] | 1667 | 2006-08-03 Scott James Remnant <scott@netsplit.com> |
| 1668 | |
Scott James Remnant | 06054ae | 2006-08-03 19:43:46 +0100 | [diff] [blame] | 1669 | * nih/child.c (nih_child_add_watch): Also takes a parent now. |
| 1670 | * nih/child.h: Update. |
| 1671 | * nih/tests/test_child.c: Update. |
| 1672 | |
Scott James Remnant | a34d416 | 2006-08-03 19:25:16 +0100 | [diff] [blame] | 1673 | * nih/io.c (nih_io_add_watch): And once more, with feeling; takes |
| 1674 | a parent for the watch. |
| 1675 | * nih/io.h: Update. |
| 1676 | * nih/tests/test_io.c: Update. |
| 1677 | |
Scott James Remnant | ee7c344 | 2006-08-03 19:22:35 +0100 | [diff] [blame] | 1678 | * nih/signal.c (nih_signal_add_callback): Give this the same treatment, |
| 1679 | it takes the parent for the signal callback. |
| 1680 | * nih/signal.h: Update. |
| 1681 | * nih/tests/test_signal.c: Update. |
| 1682 | |
Scott James Remnant | 6840fe3 | 2006-08-03 19:20:03 +0100 | [diff] [blame] | 1683 | * nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic) |
| 1684 | (nih_timer_add_scheduled): Use nih_alloc properly by taking a parent |
| 1685 | for the timer object and setting a destructor on it so that it's |
| 1686 | automatically removed when the parent is freed. |
| 1687 | * nih/timer.h: Update. |
| 1688 | * nih/tests/test_timer.c: Update function calls. |
| 1689 | * nih/tests/test_main.c (test_main_loop): Update also. |
| 1690 | |
Scott James Remnant | fade70e | 2006-08-03 19:14:42 +0100 | [diff] [blame] | 1691 | * nih/list.c (nih_list_destructor): Add a destructor function that |
| 1692 | just cuts the entry out of the list in preperation for being freed. |
| 1693 | * nih/list.h: Update. |
| 1694 | * nih/tests/test_list.c (test_destructor): Test the behaviour of |
| 1695 | the new function. |
| 1696 | |
Scott James Remnant | 76fb5ab | 2006-08-03 19:12:48 +0100 | [diff] [blame] | 1697 | * nih/tests/test_error.c: Include fixes. |
| 1698 | |
Scott James Remnant | 441e1ac | 2006-08-02 02:29:50 +0100 | [diff] [blame] | 1699 | 2006-08-02 Scott James Remnant <scott@netsplit.com> |
| 1700 | |
Scott James Remnant | 30f0191 | 2006-08-02 18:47:34 +0100 | [diff] [blame] | 1701 | * nih/signal.c (nih_signal_set_handler, nih_signal_set_default) |
| 1702 | (nih_signal_set_ignore): Reset sa_flags so that we don't pass |
| 1703 | uninitialised data for SIGALRM. |
| 1704 | (nih_signal_reset): Add function to reset signals back to their |
| 1705 | default state. |
| 1706 | * nih/signal.h: Update. |
| 1707 | * nih/tests/test_signal.c (test_reset): Add test case. |
| 1708 | |
Scott James Remnant | 11afc02 | 2006-08-02 18:38:51 +0100 | [diff] [blame] | 1709 | * nih/error.c (nih_error_raise_system): Be a lot more careful in |
| 1710 | this function! Save the value of errno in case we overwrite it |
| 1711 | and call nih_error_init() |
| 1712 | |
Scott James Remnant | 81cb8c6 | 2006-08-02 08:40:47 +0100 | [diff] [blame] | 1713 | * nih/signal.c (nih_signal_set_handler): Add the SA_NOCLDSTOP |
| 1714 | signal for SIGCHLD. |
| 1715 | |
Scott James Remnant | 3f16fca | 2006-08-02 08:20:54 +0100 | [diff] [blame] | 1716 | * nih/main.c (nih_main_loop): Drop the code that masked out the |
| 1717 | child signal, it was inherently racy and there's no particular |
| 1718 | reason to do it anyway since we use SA_RESTART in signal.c for |
| 1719 | most things. |
| 1720 | |
Scott James Remnant | a6194c4 | 2006-08-02 08:11:09 +0100 | [diff] [blame] | 1721 | * nih/signal.c (nih_signal_set_handler, nih_signal_set_default) |
| 1722 | (nih_signal_set_ignore): don't set SA_RESTART for SIGALRM. |
| 1723 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1724 | * nih/signal.c (nih_signal_set_handler, nih_signal_set_default) |
| 1725 | (nih_signal_set_ignore): use nih_return_system_error to make the |
Scott James Remnant | 468da98 | 2006-08-02 05:17:51 +0100 | [diff] [blame] | 1726 | code rather cleaner. |
| 1727 | |
| 1728 | * nih/error.h (nih_return_error): Add missing doc for retval |
| 1729 | (nih_return_system_error): Add additional useful function. |
| 1730 | * nih/tests/test_error.c (test_return_system_error): Add test |
| 1731 | case for the new macro. |
| 1732 | |
Scott James Remnant | 8b11f49 | 2006-08-02 02:59:24 +0100 | [diff] [blame] | 1733 | * nih/child.c (nih_child_poll): Convert to use waitid() so that |
| 1734 | we can obtain the information about the dead child without reaping |
| 1735 | it until we're done processing; useful because it means /proc/$PID |
| 1736 | and the child itself is still around during the handlers. |
| 1737 | * nih/child.h (NihReaper): Gains a new third argument that indicates |
| 1738 | whether the child exited normally or was killed. |
| 1739 | * nih/tests/test_child.c (test_poll): Update. |
| 1740 | |
Scott James Remnant | d2dd1b5 | 2006-08-02 02:51:40 +0100 | [diff] [blame] | 1741 | * nihify: Add a few useful sanity checks so that it works with |
| 1742 | relative paths and already-nihified directories. |
| 1743 | |
Scott James Remnant | c4bb109 | 2006-08-02 02:46:02 +0100 | [diff] [blame] | 1744 | * m4/misc.m4: Remove older force code. |
| 1745 | |
Scott James Remnant | 1dd73a6 | 2006-08-02 02:44:19 +0100 | [diff] [blame] | 1746 | * TODO: Updated. |
| 1747 | |
Scott James Remnant | e470462 | 2006-08-02 02:40:53 +0100 | [diff] [blame] | 1748 | * m4/Makefile.am (dist_aclocal_DATA): Distribute misc.m4, long |
| 1749 | missed. |
| 1750 | |
Scott James Remnant | d2dd1b5 | 2006-08-02 02:51:40 +0100 | [diff] [blame] | 1751 | * nihify: Add useful script for symlinking into source trees until |
| 1752 | we intend to get released. |
Scott James Remnant | 8ec197b | 2006-08-02 02:40:33 +0100 | [diff] [blame] | 1753 | |
Scott James Remnant | 441e1ac | 2006-08-02 02:29:50 +0100 | [diff] [blame] | 1754 | * HACKING: Correct typo (our -> out) |
| 1755 | |
Scott James Remnant | 70bc30c | 2006-07-28 02:46:48 +0100 | [diff] [blame] | 1756 | 2006-07-28 Scott James Remnant <scott@netsplit.com> |
| 1757 | |
Scott James Remnant | 1c5b624 | 2006-07-28 06:38:45 +0100 | [diff] [blame] | 1758 | * nih/main.c (nih_main_term_signal): Handy signal callback. |
| 1759 | * nih/main.h: Update. |
| 1760 | * nih/tests/test_main.c (my_timeout): Cheat and ensure the latest |
| 1761 | exit status is used. |
| 1762 | |
Scott James Remnant | 52832a0 | 2006-07-28 06:33:01 +0100 | [diff] [blame] | 1763 | * nih/main.c (nih_main_loop): Implement a main loop by calling |
| 1764 | various other functions in the right manner. |
| 1765 | (nih_main_loop_exit): Function to break the main loop. |
| 1766 | * nih/main.h: Update. |
| 1767 | * nih/tests/test_main.c (test_main_loop): Add a trivial test case |
| 1768 | for the main loop, it's damned difficult to test, but at least this |
| 1769 | ensures the bases are touched. |
| 1770 | |
Scott James Remnant | 1d5b190 | 2006-07-28 06:16:35 +0100 | [diff] [blame] | 1771 | * nih/signal.c (nih_signal_poll): Add missing call to |
| 1772 | nih_signal_init() |
| 1773 | * nih/child.c (nih_child_poll): Add missing call to nih_child_init() |
| 1774 | * nih/io.c (nih_io_poll_fds, nih_io_handle_fds): Add missing calls |
| 1775 | to nih_io_init() |
| 1776 | |
Scott James Remnant | e22dea5 | 2006-07-28 06:11:37 +0100 | [diff] [blame] | 1777 | * nih/io.c: Code for watching file descriptors and sockets for |
| 1778 | events through poll(), but not actually the poll() call itself. |
| 1779 | * nih/io.h: Typedefs, structures and prototypes. |
| 1780 | * nih/libnih.h: Include io.h |
| 1781 | * nih/tests/test_io.c: Test cases for I/O watches. |
| 1782 | * nih/Makefile.am (libnih_la_SOURCES): Build and link io.c |
| 1783 | (nihinclude_HEADERS): Install io.h |
| 1784 | (TESTS): Build and run I/O test cases |
| 1785 | (test_io_SOURCES, test_io_LDFLAGS, test_io_LDADD): Details for I/O |
| 1786 | test case binary. |
| 1787 | |
Scott James Remnant | 2929993 | 2006-07-28 06:11:26 +0100 | [diff] [blame] | 1788 | * nih/tests/test_timer.c (test_poll): Free entry after testing. |
| 1789 | |
Scott James Remnant | 88f0459 | 2006-07-28 04:32:33 +0100 | [diff] [blame] | 1790 | * nih/child.c (nih_child_poll): When the reaper is for a particular |
| 1791 | process, be sure to remove it from the list. |
| 1792 | * nih/tests/test_child.c (test_poll): Test for that. |
| 1793 | |
Scott James Remnant | c5bfa47 | 2006-07-28 04:21:36 +0100 | [diff] [blame] | 1794 | * nih/child.c: Simple bit of code to wait for children to |
| 1795 | terminate and dispatch the reaper functions for them. |
| 1796 | * nih/child.h: Typedefs, structures and prototypes. |
| 1797 | * nih/libnih.h: Include child.h |
| 1798 | * nih/tests/test_child.c: Test cases for child handling code. |
| 1799 | * nih/Makefile.am (libnih_la_SOURCES): Build and link child.c |
| 1800 | (nihinclude_HEADERS): Install child.h |
| 1801 | (TESTS): Build and run child test cases |
| 1802 | (test_child_SOURCES, test_child_LDFLAGS, test_child_LDADD): Details |
| 1803 | for child test case binary. |
| 1804 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1805 | * nih/timer.c (nih_timer_add_timeout, nih_timer_add_periodic) |
| 1806 | (nih_timer_add_scheduled): Change argument order so that the time |
Scott James Remnant | 37e8eb5 | 2006-07-28 02:52:06 +0100 | [diff] [blame] | 1807 | information is first, to match signal functions. |
| 1808 | * nih/timer.h: Update. |
| 1809 | * nih/tests/test_timer.c: Update. |
| 1810 | |
Scott James Remnant | ee5dec7 | 2006-07-28 02:48:43 +0100 | [diff] [blame] | 1811 | * nih/signal.h: Include the system signal.h for ease of use. |
| 1812 | |
Scott James Remnant | 70bc30c | 2006-07-28 02:46:48 +0100 | [diff] [blame] | 1813 | * nih/signal.c: Code for handling signals inside the main loop, |
| 1814 | rather than trying to fit delicate code in a signal handler; and |
| 1815 | for making it generally easier to handle signals. |
| 1816 | * nih/signal.h: Typedefs and prototypes. |
| 1817 | * nih/libnih.h: Include signal.h |
| 1818 | * nih/Makefile.am (libnih_la_SOURCES): Build and link signal.c |
| 1819 | (nihinclude_HEADERS): Install signal.h |
| 1820 | (TESTS): Build and run signal test cases |
| 1821 | (test_signal_SOURCES, test_signal_LDFLAGS, test_signal_LDADD): Details |
| 1822 | for signal test case binary. |
| 1823 | |
Scott James Remnant | 3a0f878 | 2006-07-27 18:39:54 +0100 | [diff] [blame] | 1824 | 2006-07-27 Scott James Remnant <scott@netsplit.com> |
| 1825 | |
Scott James Remnant | 4eeca5e | 2006-07-27 23:28:00 +0100 | [diff] [blame] | 1826 | * nih/timer.c: Code for timeouts, periodic and scheduled timers, |
| 1827 | note that the actual scheduling part of scheduled timers it not |
| 1828 | implemented yet (we need to think a bit more about it) |
| 1829 | * nih/timer.h: Structures, macros and prototypes. |
| 1830 | * nih/libnih.h: Include timer.h |
| 1831 | * nih/tests/test_timer.c: Test cases for timer code. |
| 1832 | * nih/Makefile.am (libnih_la_SOURCES): Build and link timer.c |
| 1833 | (nihinclude_HEADERS): Install timer.h |
| 1834 | (TESTS): Build and run timer test cases |
| 1835 | (test_timer_SOURCES, test_timer_LDFLAGS, test_timer_LDADD): Details |
| 1836 | for timer test case binary. |
| 1837 | |
Scott James Remnant | 2bd715e | 2006-07-27 22:58:33 +0100 | [diff] [blame] | 1838 | * nih/alloc.c (nih_free): Use new safe list iteration macro. |
| 1839 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1840 | * nih/hash.c (nih_hash_add_unique, nih_hash_replace) |
| 1841 | (nih_hash_search): Use new list iteration macros. |
Scott James Remnant | 7f12ab6 | 2006-07-27 22:58:15 +0100 | [diff] [blame] | 1842 | |
Scott James Remnant | 48eb897 | 2006-07-27 22:57:27 +0100 | [diff] [blame] | 1843 | * nih/list.h (NIH_LIST_FOREACH): New macro that expands to the usual |
| 1844 | list iteration for loop, prevents mistakes. |
| 1845 | (NIH_LIST_FOREACH_SAFE): Macro that does the same as above, but also |
| 1846 | includes a "next" variable to allow safe iteration; especially useful |
| 1847 | to prevent us getting this wrong! |
| 1848 | * nih/tests/test_list.c (test_foreach, test_foreach_safe): Add test |
| 1849 | cases for iteration. |
| 1850 | |
Scott James Remnant | c2b73bc | 2006-07-27 18:49:27 +0100 | [diff] [blame] | 1851 | * nih/error.c (nih_error_init): Make inline and check value first. |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1852 | (nih_error_raise, nih_error_raise_printf, nih_error_raise_again) |
| 1853 | (nih_error_push_context): Unconditionally call nih_error_init. |
Scott James Remnant | c2b73bc | 2006-07-27 18:49:27 +0100 | [diff] [blame] | 1854 | |
Scott James Remnant | 361a64b | 2006-07-27 18:48:02 +0100 | [diff] [blame] | 1855 | * nih/alloc.c (nih_alloc_init): Make inline and check value first. |
| 1856 | (nih_alloc): Unconditionally call nih_alloc_init. |
| 1857 | |
Scott James Remnant | c840e39 | 2006-07-27 18:47:21 +0100 | [diff] [blame] | 1858 | * nih/logging.c (nih_log_init): Use the proper functions to |
| 1859 | initialise details, check values first; also make inline. |
| 1860 | (nih_log_message): Unconditionally call nih_log_init. |
| 1861 | |
Scott James Remnant | c2e442b | 2006-07-27 18:40:22 +0100 | [diff] [blame] | 1862 | * nih/Makefile.am (DEFS): Append to the default DEFS list, rather |
| 1863 | than overriding, otherwise we lose HAVE_CONFIG_H |
| 1864 | |
Scott James Remnant | 3a0f878 | 2006-07-27 18:39:54 +0100 | [diff] [blame] | 1865 | * nih/macros.h: Check for ENABLE_NLS instead of HAVE_GETTEXT and |
| 1866 | include libintl.h if defined as well. |
| 1867 | |
Scott James Remnant | 0efbb8f | 2006-07-20 02:30:05 +0100 | [diff] [blame] | 1868 | 2006-07-20 Scott James Remnant <scott@netsplit.com> |
| 1869 | |
Scott James Remnant | a56ead6 | 2006-07-20 02:54:06 +0100 | [diff] [blame] | 1870 | * nih/string.c (nih_strv_free): Add a function to free an array |
| 1871 | of strings. |
| 1872 | * nih/string.h: Update. |
| 1873 | * nih/tests/test_string.c (test_strv_free): Test the function. |
| 1874 | |
Scott James Remnant | 81616de | 2006-07-20 02:41:06 +0100 | [diff] [blame] | 1875 | * nih/error.c: Error handling code. |
| 1876 | * nih/error.h: Structures, macros and prototypes. |
| 1877 | * nih/errors.h: Error enum and message definitions. |
| 1878 | * nih/libnih.h: Include error.h and errors.h |
| 1879 | * nih/tests/test_error.c: Error handling test cases. |
| 1880 | * nih/Makefile.am (libnih_la_SOURCES): Build and link error.h |
| 1881 | (nihinclude_HEADERS): Install error.h |
| 1882 | (TESTS): Build and run error handling test cases. |
| 1883 | (test_error_SOURCES, test_error_LDFLAGS, test_error_LDADD): Binary |
| 1884 | for error handling test cases. |
| 1885 | |
Scott James Remnant | 15802c2 | 2006-07-20 02:40:30 +0100 | [diff] [blame] | 1886 | * nih/macros.h (NIH_MUST, NIH_MUST_NOT): Add handy macros to spin |
| 1887 | until we get a true or false value from an assignment. Usually |
| 1888 | used around a call to memory allocation functions that we can't |
| 1889 | deal with failing. |
| 1890 | |
Scott James Remnant | 9d80a0f | 2006-07-20 02:38:29 +0100 | [diff] [blame] | 1891 | * nih/main.c (nih_main_package_string): Change package_string |
| 1892 | to be a module-level static so it can be reset by a call to |
| 1893 | nih_main_init_full. Always return if not NULL. |
| 1894 | * nih/tests/test_main.c (test_package_string): Call nih_main_init_full |
| 1895 | instead of futzing with variables so the static string is reset. |
| 1896 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1897 | * nih/alloc.c (nih_alloc_using, nih_alloc, nih_realloc) |
| 1898 | (nih_alloc_size, nih_alloc_parent): Make various argument pointers |
Scott James Remnant | 533137c | 2006-07-20 02:37:00 +0100 | [diff] [blame] | 1899 | const. |
| 1900 | * nih/alloc.h: Update. |
| 1901 | |
Scott James Remnant | 36a4350 | 2006-07-20 02:35:37 +0100 | [diff] [blame] | 1902 | * nih/libnih.h, nih/logging.c, nih/main.c: Update to include |
| 1903 | string.h not strutil.h |
| 1904 | |
Scott James Remnant | 0efbb8f | 2006-07-20 02:30:05 +0100 | [diff] [blame] | 1905 | * nih/strutil.c: Renamed to nih/string.c |
| 1906 | * nih/strutil.h: Renamed to nih/string.h |
| 1907 | * nih/tests/test_strutil.c: Renamed to nih/tests/test_string.h |
| 1908 | * nih/Makefile.am (DEFAULT_INCLUDES): Override to stop automake doing |
| 1909 | silly things like putting -I. in the pre-processor flags. |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1910 | (libnih_la_SOURCES, nihinclude_HEADERS, TESTS) |
| 1911 | (test_string_SOURCES, test_string_LDFLAGS, test_string_LDADD): Update. |
Scott James Remnant | 0efbb8f | 2006-07-20 02:30:05 +0100 | [diff] [blame] | 1912 | |
Scott James Remnant | e7bb309 | 2006-07-19 23:18:32 +0100 | [diff] [blame] | 1913 | 2006-07-19 Scott James Remnant <scott@netsplit.com> |
| 1914 | |
| 1915 | * nih/alloc.h, nih/logging.h, nih/strutil.h: Reformat attribute |
| 1916 | declarations to not upset emacs indentation. |
| 1917 | |
Scott James Remnant | 06424b4 | 2006-07-17 21:12:55 +0100 | [diff] [blame] | 1918 | 2006-07-17 Scott James Remnant <scott@netsplit.com> |
| 1919 | |
| 1920 | * nih/strutil.c (nih_strdup): Implement an nih_alloc-based strdup. |
| 1921 | (nih_strdup): and strndup. |
| 1922 | * nih/strutil.h: Update. |
| 1923 | * nih/tests/test_strutil.c: Test new functions. |
| 1924 | |
Scott James Remnant | ab30a42 | 2006-07-13 01:54:58 +0100 | [diff] [blame] | 1925 | 2006-07-13 Scott James Remnant <scott@netsplit.com> |
| 1926 | |
Scott James Remnant | bda41e1 | 2006-07-13 22:41:30 +0100 | [diff] [blame] | 1927 | * nih/alloc.c (nih_free): Remove the entry from the parent's list. |
| 1928 | |
Scott James Remnant | b51443b | 2006-07-13 22:40:33 +0100 | [diff] [blame] | 1929 | * nih/logging.h (nih_assert): Reexpress to avoid polluting if |
| 1930 | statements without an else. |
| 1931 | |
Scott James Remnant | caa78bf | 2006-07-13 22:40:15 +0100 | [diff] [blame] | 1932 | * nih/alloc.c (nih_realloc): Implement a function that reallocates |
| 1933 | a block of memory with the original allocator. |
| 1934 | (nih_alloc_init): Don't double-check the allocator. |
| 1935 | * nih/alloc.h: Update. |
| 1936 | * nih/tests/test_alloc.c (test_realloc): Check behaviour of realloc. |
| 1937 | |
Scott James Remnant | 45ff495 | 2006-07-13 22:11:09 +0100 | [diff] [blame] | 1938 | * nih/alloc.c (NihAllocCtx): Drop the name pointer, we never used |
| 1939 | that anyway. |
| 1940 | (nih_alloc_using): Drop name parameter. |
| 1941 | (nih_alloc_named): Rename to nih_alloc. |
| 1942 | (nih_alloc_set_name): Drop this function. |
| 1943 | (nih_alloc_name): And this one. |
| 1944 | * nih/alloc.h (nih_new): Simplify. |
| 1945 | (nih_alloc): Drop entirely now it's unneeded. |
| 1946 | * nih/tests/test_alloc.c: Update. |
| 1947 | * nih/tests/test_list.c (test_new): Test using nih_alloc_size |
| 1948 | rather than nih_alloc_name. |
| 1949 | |
Scott James Remnant | 26b95ff | 2006-07-13 02:07:18 +0100 | [diff] [blame] | 1950 | * nih/logging.h: Put the log priorities back in ascending order, |
| 1951 | but use the zero to mean "unknown". Fix up the descriptions to be |
| 1952 | a little more consistent. |
| 1953 | * nih/logging.c: Rename max_priority back to min_priority so it |
| 1954 | all makes more sense again. |
| 1955 | (nih_log_init): Warning is the default minimum priority to show. |
| 1956 | (nih_log_set_priority): Set minimum priority. |
| 1957 | (nih_log_message): Discard messages below the minimum priority. |
| 1958 | (nih_logger_printf): Use stderr when priority is greater than or |
| 1959 | equal to warning. |
| 1960 | * nih/tests/test_logging.c: Update to match. |
| 1961 | |
Scott James Remnant | ab30a42 | 2006-07-13 01:54:58 +0100 | [diff] [blame] | 1962 | * nih/logging.c (nih_log_message): Use nih_vsprintf which makes the |
| 1963 | function not core dump (always good, that). |
| 1964 | |
Scott James Remnant | 76586af | 2006-07-12 23:40:14 +0100 | [diff] [blame] | 1965 | 2006-07-12 Scott James Remnant <scott@netsplit.com> |
| 1966 | |
Scott James Remnant | 595e01b | 2006-07-12 23:41:05 +0100 | [diff] [blame] | 1967 | * nih/main.c (nih_main_package_string): Use nih_sprintf and make |
| 1968 | the function rather simpler. |
| 1969 | |
Scott James Remnant | 0e32c79 | 2006-07-12 23:40:35 +0100 | [diff] [blame] | 1970 | * nih/tests/test_alloc.c (main): Formatting fix. |
| 1971 | |
Scott James Remnant | 76586af | 2006-07-12 23:40:14 +0100 | [diff] [blame] | 1972 | * nih/strutil.c (nih_sprintf): Function to wrap sprintf, allocating |
| 1973 | the necessary space using nih_alloc first. |
| 1974 | (nih_vsprintf): Function to wrap vsprintf, allocating the necessary |
| 1975 | space using nih_alloc first. |
| 1976 | * nih/strutil.h: Prototypes. |
| 1977 | * nih/libnih.h: Include strutil.h |
| 1978 | * nih/Makefile.am (libnih_la_SOURCES): Build and link strutil.c |
| 1979 | (nihinclude_HEADERS): Install strutil.h |
| 1980 | (TESTS): Build and run strutil test cases |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 1981 | (test_strutil_SOURCES, test_strutil_LDFLAGS) |
| 1982 | (test_strutil_LDADD): Binary for strutil test cases. |
Scott James Remnant | 76586af | 2006-07-12 23:40:14 +0100 | [diff] [blame] | 1983 | |
Scott James Remnant | 4944c0c | 2006-07-05 04:02:24 +0100 | [diff] [blame] | 1984 | 2006-07-05 Scott James Remnant <scott@netsplit.com> |
| 1985 | |
Scott James Remnant | d236e77 | 2006-07-05 13:49:50 +0100 | [diff] [blame] | 1986 | * nih/logging.c (nih_log_message): Don't bother catching |
| 1987 | vsnprintf's return value, C99 doesn't allow it to fail. |
| 1988 | * nih/main.c (nih_main_package_string): Likewise for here. |
| 1989 | |
Scott James Remnant | 4944c0c | 2006-07-05 04:02:24 +0100 | [diff] [blame] | 1990 | * nih/logging.c (nih_log_message): Don't use a static variable |
| 1991 | for no apparent reason, just free afterwards. Catch vsnprintf and |
| 1992 | malloc failing. |
| 1993 | * nih/main.c (nih_main_package_string): Catch snprintf and realloc |
| 1994 | failing here too. |
| 1995 | |
Scott James Remnant | 0d13698 | 2006-05-30 14:28:49 +0100 | [diff] [blame] | 1996 | 2006-05-30 Scott James Remnant <scott@netsplit.com> |
| 1997 | |
Scott James Remnant | beea067 | 2006-05-30 14:59:16 +0100 | [diff] [blame] | 1998 | * nih/logging.h (nih_assert): Assertion macro that uses our logging |
| 1999 | rather than stderr. |
| 2000 | * nih/alloc.c, nih/hash.c, nih/list.c, nih/logging.c, nih/main.c: |
| 2001 | Use nih_assert rather than assert. |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2002 | * nih/Makefile.am (test_alloc_LDFLAGS, test_list_LDFLAGS) |
| 2003 | (test_hash_LDFLAGS, test_main_LDFLAGS, test_logging_LDFLAGS): Link |
Scott James Remnant | beea067 | 2006-05-30 14:59:16 +0100 | [diff] [blame] | 2004 | libraries statically. |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2005 | (test_alloc_LDADD, test_list_LDADD, test_hash_LDADD) |
| 2006 | (test_main_LDADD, test_logging_LDADD): Just link to the library. |
Scott James Remnant | beea067 | 2006-05-30 14:59:16 +0100 | [diff] [blame] | 2007 | |
Scott James Remnant | 0d13698 | 2006-05-30 14:28:49 +0100 | [diff] [blame] | 2008 | * nih/macros.h (NIH_STRINGIFY): Correct typo (-s -> _s) |
| 2009 | (NIH_LIKELY, NIH_UNLIKELY): Add branch prediction macros. |
| 2010 | |
Scott James Remnant | b31cf30 | 2006-05-29 17:59:02 +0100 | [diff] [blame] | 2011 | 2006-05-29 Scott James Remnant <scott@netsplit.com> |
| 2012 | |
Scott James Remnant | bdcdadc | 2006-05-29 19:15:12 +0100 | [diff] [blame] | 2013 | * nih/alloc.c (nih_alloc_init): Restore this function, it's better |
| 2014 | style to keep variables in shared libraries as zero. |
| 2015 | (nih_alloc_named): Call nih_alloc_init once more. |
| 2016 | * nih/logging.h: Reorder such that NONE is the lowest value. |
| 2017 | * nih/logging.c (min_priority): Rename to max_priority and set value |
| 2018 | to NIH_LOG_NONE (zero). |
| 2019 | (nih_log_init): Initialise the default logger and priority. |
| 2020 | (nih_log_set_priority): Assert priority is greater than NONE. |
| 2021 | (nih_log_message): Initialise the logging if necessary. |
| 2022 | (nih_logger_printf): Check priority with <= |
| 2023 | |
Scott James Remnant | 712e14f | 2006-05-29 18:51:50 +0100 | [diff] [blame] | 2024 | * TODO: Update. |
| 2025 | |
Scott James Remnant | bcf7661 | 2006-05-29 18:51:29 +0100 | [diff] [blame] | 2026 | * nih/logging.c: Code for formatting log messages and filtering |
| 2027 | based on priority. |
| 2028 | * nih/logging.h: Prototypes and macros. |
| 2029 | * nih/libnih.h: Include logging.h |
| 2030 | * nih/tests/test_logging.c: Logging test cases. |
| 2031 | * nih/Makefile.am (libnih_la_SOURCES): Build and link logging.c |
| 2032 | (nihinclude_HEADERS): Install logging.h |
| 2033 | (TESTS): Build and run logging test cases. |
| 2034 | (test_logging_SOURCES, test_logging_LDADD): Binary for logging |
| 2035 | test cases. |
| 2036 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2037 | * nih/tests/test_main.c (test_package_string, test_suggest_help) |
| 2038 | (test_version): Add missing comments before tests. |
Scott James Remnant | 1b60ce1 | 2006-05-29 18:42:37 +0100 | [diff] [blame] | 2039 | (test_suggest_help, test_version): Close the duplicated stdout/stderr |
| 2040 | before leaving the test. |
| 2041 | |
Scott James Remnant | b31cf30 | 2006-05-29 17:59:02 +0100 | [diff] [blame] | 2042 | * nih/alloc.h: Declare nih_alloc_named and nih_alloc_using with |
| 2043 | the warn_unused_result and malloc attributes. |
| 2044 | |
Scott James Remnant | 502c056 | 2006-05-27 12:15:25 +0100 | [diff] [blame] | 2045 | 2006-05-27 Scott James Remnant <scott@netsplit.com> |
| 2046 | |
| 2047 | * m4/compiler.m4 (NIH_COMPILER_WARNINGS): Drop -pedantic as we |
| 2048 | usually want gcc extensions (all the world IS gcc). |
| 2049 | |
Scott James Remnant | 3a9480e | 2006-05-26 17:18:45 +0100 | [diff] [blame] | 2050 | 2006-05-26 Scott James Remnant <scott@netsplit.com> |
| 2051 | |
Scott James Remnant | b374f2c | 2006-05-26 17:53:11 +0100 | [diff] [blame] | 2052 | * nih/main.c (nih_main_init_full): Only take the basename of |
| 2053 | the program name, not the full path. |
| 2054 | (nih_main_package_string): Use an allocated piece of memory rather |
| 2055 | than some on the stack, with C99-style snprintf to do the right thing |
| 2056 | with it. |
| 2057 | * nih/tests/test_main.c (test_init): Include check for basename. |
| 2058 | (test_package_string): Drop tests involving basename here. |
| 2059 | |
Scott James Remnant | b008712 | 2006-05-26 17:44:09 +0100 | [diff] [blame] | 2060 | * m4/compiler.m4 (NIH_TRY_C99): Macro that tries compiling |
| 2061 | some code full of C99 features. |
| 2062 | (NIH_C_C99): Use the above macro to determine whether the compiler |
| 2063 | supports C99, or whether it can do it with a compiler flag. |
| 2064 | * configure.ac: Make sure the compiler does C99. |
| 2065 | |
Scott James Remnant | 6c7870a | 2006-05-26 17:42:30 +0100 | [diff] [blame] | 2066 | * nih/list.c: Add missing prototype for nih_list_cut. |
| 2067 | * nih/hash.c: Add missing prototype for fnv_hash. |
| 2068 | |
Scott James Remnant | 13cd7a8 | 2006-05-26 17:34:38 +0100 | [diff] [blame] | 2069 | * nih/macros.h (_, N_): Define gettext-wrapper macros if |
| 2070 | HAVE_GETTEXT, otherwise define them to just expand to their string. |
| 2071 | |
Scott James Remnant | 88d73e8 | 2006-05-26 17:34:16 +0100 | [diff] [blame] | 2072 | * nih/main.h: Drop comments for global variables. |
| 2073 | * nih/main.c: Provide proper docstrings for them here. |
| 2074 | |
Scott James Remnant | 3a9480e | 2006-05-26 17:18:45 +0100 | [diff] [blame] | 2075 | * nih/alloc.c (nih_alloc_init): Drop this function, instead just |
| 2076 | initialise the static variable directly. |
| 2077 | (nih_alloc_set_allocator): Correct parameter name in docstring, |
| 2078 | don't call nih_alloc_init (it's already initialised). |
| 2079 | |
Scott James Remnant | 2fbdd9e | 2006-05-24 10:42:39 +0100 | [diff] [blame] | 2080 | 2006-05-24 Scott James Remnant <scott@netsplit.com> |
| 2081 | |
| 2082 | * nih/main.c (nih_main_package_string): Clarify documentation. |
| 2083 | |
Scott James Remnant | 8017ccf | 2006-05-23 09:12:43 +0100 | [diff] [blame] | 2084 | 2006-05-23 Scott James Remnant <scott@netsplit.com> |
| 2085 | |
| 2086 | * nih/main.c: Add code for the various little functions that we |
| 2087 | usually call from main(). |
| 2088 | * nih/main.h: Prototypes and macros. |
| 2089 | * nih/libnih.h: Include main.h |
| 2090 | * nih/Makefile.am (libnih_la_SOURCES): Build and link main.c |
| 2091 | (nihinclude_HEADERS): Install main.h |
| 2092 | (TESTS): Build and run main test-cases |
| 2093 | (test_main_SOURCES, test_main_LDADD): Code for main tests. |
| 2094 | * m4/misc.m4 (AC_COPYRIGHT): Wraps the Autoconf AC_COPYRIGHT macro |
| 2095 | but also defines PACKAGE_COPYRIGHT |
| 2096 | * m4/compiler.m4: Temporary hack to make sure misc.m4 gets dragged |
| 2097 | in as aclocal doesn't notice it, will go away once we get something |
| 2098 | that aclocal will notice. |
| 2099 | |
Scott James Remnant | 839c8f0 | 2006-04-26 16:58:50 +0100 | [diff] [blame] | 2100 | 2006-04-26 Scott James Remnant <scott@netsplit.com> |
| 2101 | |
Scott James Remnant | b643f5e | 2006-04-26 18:32:44 +0100 | [diff] [blame] | 2102 | * nih/hash.c: Add code for FNV hash tables that uses NihList for |
| 2103 | the actual bins so is largely polymorphic. |
| 2104 | * nih/hash.h: Prototypes, macros and structures. |
| 2105 | * nih/macros.h: Include stdint.h as well, we use that a lot. |
| 2106 | * nih/libnih.h: Include hash.h |
| 2107 | * nih/tests/test_hash.c: Test cases for new hash table code. |
| 2108 | * nih/Makefile.am (libnih_la_SOURCES): Build and link hash.c |
| 2109 | (nihinclude_HEADERS): Install hash.h |
| 2110 | (TESTS): Build and run hash table test-cases. |
| 2111 | (test_hash_SOURCES, test_hash_LDADD): Code for hash table tests. |
| 2112 | * TODO: Update. |
| 2113 | |
Scott James Remnant | e8c0653 | 2006-04-26 17:32:02 +0100 | [diff] [blame] | 2114 | * nih/tests/test_list.c (test_empty): Fix faulty test case that |
| 2115 | actually proved one-entry lists were showing up as empty! |
| 2116 | * nih/list.h (NIH_LIST_EMPTY): Compare the next and previous pointers |
| 2117 | against the list pointer itself! |
| 2118 | |
Scott James Remnant | 839c8f0 | 2006-04-26 16:58:50 +0100 | [diff] [blame] | 2119 | * nih/list.c (nih_list_cut): Add an inline function that does the |
| 2120 | job of nih_list_remove without calling nih_list_init afterwards. |
| 2121 | (nih_list_remove): Call nih_list_cut rather than modifying pointers. |
| 2122 | (nih_list_free): Use nih_list_cut for efficiency, no point fixing |
| 2123 | the pointers if we're just going to free it. |
| 2124 | (nih_list_add, nih_list_add_after): Use nih_list_cut as the pointers |
| 2125 | get modified afterwards anyway, more efficient this way. |
| 2126 | |
Scott James Remnant | 011adce | 2006-04-25 03:49:54 +0100 | [diff] [blame] | 2127 | 2006-04-25 Scott James Remnant <scott@netsplit.com> |
| 2128 | |
Scott James Remnant | f089f70 | 2006-04-25 21:36:49 +0100 | [diff] [blame] | 2129 | * nih/list.c: Remove unnecessary include of stdlib.h |
| 2130 | |
Scott James Remnant | 92a3c14 | 2006-04-25 19:43:04 +0100 | [diff] [blame] | 2131 | * nih/list.c (nih_list_new): Fix formatting of docstring. |
| 2132 | * nih/alloc.c (nih_alloc_using, nih_alloc_parent): Fix formatting |
| 2133 | of docstring. |
| 2134 | (nih_alloc_named): Fix docstring to mention NULL can be returned. |
| 2135 | * nih/tests/test_alloc.c, nih/tests/test_list.c: Add missing blank |
| 2136 | line before includes. |
| 2137 | |
Scott James Remnant | 9a1fb11 | 2006-04-25 03:52:14 +0100 | [diff] [blame] | 2138 | * nih/alloc.c (nih_alloc_using): Return NULL if the allocation |
| 2139 | fails. |
| 2140 | * nih/list.c (nih_list_new): Also return NULL if the allocation |
| 2141 | fails. |
| 2142 | |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2143 | * nih/alloc.c (nih_alloc_set_allocator, nih_alloc_using) |
| 2144 | (nih_free, nih_alloc_set_name, nih_alloc_set_destructor) |
| 2145 | (nih_alloc_name, nih_alloc_size, nih_alloc_parent): Use assert |
Scott James Remnant | 011adce | 2006-04-25 03:49:54 +0100 | [diff] [blame] | 2146 | to uncover programming errors. |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2147 | * nih/list.c (nih_list_init, nih_list_remove, nih_list_free) |
| 2148 | (nih_list_add, nih_list_add_after): Use assert to uncover |
Scott James Remnant | 011adce | 2006-04-25 03:49:54 +0100 | [diff] [blame] | 2149 | programming errors. |
| 2150 | (nih_list_new): Comment that nih_new may return NULL and we need |
| 2151 | to make sure we catch that. |
| 2152 | |
Scott James Remnant | 12ffa34 | 2006-04-24 22:33:20 +0100 | [diff] [blame] | 2153 | 2006-04-24 Scott James Remnant <scott@netsplit.com> |
| 2154 | |
Scott James Remnant | 220b43b | 2006-04-24 22:54:39 +0100 | [diff] [blame] | 2155 | * m4/Makefile.am (dist_aclocal_DATA): Add missing \ |
| 2156 | * nih/Makefile.am (INCLUDES): Include top_srcdir otherwise we |
| 2157 | can't be built out of tree. |
| 2158 | |
Scott James Remnant | c6e0444 | 2006-04-24 22:51:27 +0100 | [diff] [blame] | 2159 | * m4/Makefile.am (dist_aclocal_DATA): Install the m4 files into |
| 2160 | the aclocal directory, not a package specific one. |
| 2161 | * m4/compiler.m4, m4/linker.m4: Fix closing comment style. |
| 2162 | |
Scott James Remnant | 12ffa34 | 2006-04-24 22:33:20 +0100 | [diff] [blame] | 2163 | * TODO: Add TODO file. |
| 2164 | * nih/list.h (NIH_LIST_EMPTY): Document what this actually does. |
| 2165 | |
Scott James Remnant | ff10cd3 | 2006-04-19 10:12:23 +0100 | [diff] [blame] | 2166 | 2006-04-19 Scott James Remnant <scott@netsplit.com> |
| 2167 | |
| 2168 | * nih/list.c (nih_list_entry_new): Removed. This makes the list |
| 2169 | code more focussed and generic, but also we'll nearly always want |
| 2170 | the data member to be an nih_alloc child of the list, rather than |
| 2171 | the other way around! |
Scott James Remnant | d4b03b9 | 2006-08-02 08:15:26 +0100 | [diff] [blame] | 2172 | * nih/list.h (NihListEntry, nih_list_add_new) |
| 2173 | (nih_list_add_new_after): Likewise, remove the structure and helper |
Scott James Remnant | ff10cd3 | 2006-04-19 10:12:23 +0100 | [diff] [blame] | 2174 | macros; if we find ourselves wanting this, we can put it in a new |
| 2175 | file and just make it polymorphic like we plan for hashes. |
| 2176 | * nih/tests/test_list.c: Replace all uses of NihListEntry with plain |
| 2177 | NihList, we never checked the data members anyway. |
| 2178 | (test_entry_new): Remove test case. |
| 2179 | (test_add): Remove test of nih_list_add_new macro. |
| 2180 | (test_add_after): Remove test of nih_list_add_new_after macro. |
| 2181 | (test_empty): Check macro works with any list entry. |
| 2182 | (test_remove): Test removal of the last list entry, and removal |
| 2183 | on an already empty list. |
| 2184 | (test_free): Don't check the pointers of a block we've just freed! |
| 2185 | |
Scott James Remnant | f10cd87 | 2006-04-18 18:37:04 +0100 | [diff] [blame] | 2186 | 2006-04-18 Scott James Remnant <scott@netsplit.com> |
| 2187 | |
| 2188 | * nih/alloc.c (nih_alloc_init): Call nih_alloc_set_allocator. |
| 2189 | * nih/alloc.h (NihDestructor): Clarify docstring to not refer |
| 2190 | to internal structures. |
| 2191 | * nih/list.h (NIH_LIST_EMPTY): Add convenience macro for this |
| 2192 | common operation. |
| 2193 | * nih/tests/test_list.c (test_empty): Test the new macro. |
| 2194 | |
Scott James Remnant | b365c5f | 2006-04-16 08:16:18 +0100 | [diff] [blame] | 2195 | 2006-04-16 Scott James Remnant <scott@netsplit.com> |
| 2196 | |
Scott James Remnant | 84ccd44 | 2006-04-16 12:41:13 +0100 | [diff] [blame] | 2197 | * nih/list.c (nih_list_new, nih_list_entry_new): Call nih_new rather |
| 2198 | than malloc so the list can be a context for data members. |
| 2199 | (nih_list_free): Call nih_free rather than free. |
| 2200 | * nih/tests/test_list.c: Test cases should not be static. |
| 2201 | (test_new, test_entry_new): Check the new object was allocated using |
| 2202 | our nih_alloc function. |
| 2203 | (test_remove): Test a second removal. |
| 2204 | (destructor_called): Function to test whether destructor was called. |
| 2205 | (test_free): Test now that we can use an NihDestructor. |
| 2206 | * nih/Makefile.am (test_list_LDADD): Link alloc.o now that lists |
| 2207 | depend on the allocator. |
| 2208 | |
Scott James Remnant | 2a9b765 | 2006-04-16 12:32:45 +0100 | [diff] [blame] | 2209 | * nih/list.c, nih/list.h: Fix docstrings to use references where |
| 2210 | useful. Split functions into blocks separated by a newline. |
| 2211 | |
Scott James Remnant | f7c2d22 | 2006-04-16 12:28:24 +0100 | [diff] [blame] | 2212 | * nih/alloc.h: Update and fix formatting. |
| 2213 | (NihAllocDestructor): Rename to NihDestructor. |
| 2214 | * nih/alloc.c (nih_alloc_init): Make safe against repeated calls. |
| 2215 | (nih_alloc_set_allocator): New function to set the default allocator, |
| 2216 | overriding any set already. |
| 2217 | (nih_alloc_set_destructor): Update type of destructor argument.. |
| 2218 | (NihAllocCtx): Update type of destructor member. |
| 2219 | * nih/tests/test_alloc.c (my_realloc): Wrapper around realloc so |
| 2220 | we can check custom allocators are called properly. |
| 2221 | (test_alloc_using): Test allocation with a custom allocator. |
| 2222 | (test_free): Check that the block is freed using the allocator, |
| 2223 | also update destructor checking. |
| 2224 | (test_set_allocator): Test new allocator is used. |
| 2225 | |
Scott James Remnant | cf980f2 | 2006-04-16 12:00:16 +0100 | [diff] [blame] | 2226 | * nih/alloc.c (nih_alloc_using): New one-shot function to use a given |
| 2227 | realloc-style function to make a named block of memory of a given size. |
| 2228 | (nih_alloc_named): Replace with a thin-wrapper around nih_alloc_using |
| 2229 | that passes in the default allocator. |
| 2230 | (NihAllocCtx): Add new allocator member to store the allocator used, |
| 2231 | so we free with the right one. |
| 2232 | (nih_alloc_init): Set the default allocator to realloc(). Drop |
| 2233 | pool initialisation code. |
| 2234 | (nih_free): Call the context's original allocator with zero size. |
| 2235 | (used_pool, unused_pool, NIH_ALLOC_SMALLEST): Remove, these really |
| 2236 | belong in distinct memory handling code. |
| 2237 | (nih_alloc_set, nih_alloc_new): Drop functions only needed if we're |
| 2238 | doing our own memory management. |
| 2239 | (nih_alloc_size, nih_alloc_parent): Add a couple of useful functions. |
| 2240 | * nih/alloc.h (NihAllocator): Typedef for allocator function prototype. |
| 2241 | (nih_alloc): Rename to nih_new. |
| 2242 | (nih_alloc_size): Rename to nih_alloc. |
| 2243 | * nih/tests/test_alloc.c (test_alloc_named, test_new, test_alloc): Test |
| 2244 | behaviour of standard functions with and without parents. |
| 2245 | (destructor_called): Allow it to be called multiple times, change |
| 2246 | to static to enforce modularity. |
| 2247 | (child_destructor_called): Another function for testing multiple |
| 2248 | destructors. |
| 2249 | (test_free): Test nih_free using alloc destructors. |
| 2250 | (test_alloc_set_name): Rename to just test_set_name for consistency. |
| 2251 | |
Scott James Remnant | b365c5f | 2006-04-16 08:16:18 +0100 | [diff] [blame] | 2252 | * nih/macros.h (NIH_STRINGIFY): Generic hack to turn a numeric |
| 2253 | macro into a string. |
| 2254 | * nih/alloc.h (nih_alloc, nih_alloc_size): Use generic NIH_STRINGIFY |
| 2255 | macro instead of our home-cooked one. |
| 2256 | |
Scott James Remnant | f47c7cf | 2006-03-31 16:36:41 +0100 | [diff] [blame] | 2257 | 2006-03-31 Scott James Remnant <scott@netsplit.com> |
| 2258 | |
| 2259 | * nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h, nih/macros.h, |
| 2260 | nih/libnih.h, nih/tests/test_alloc.c, |
| 2261 | nih/tests/test_list.c: Update FSF address in GPL header. |
| 2262 | |
Scott James Remnant | 8baaefe | 2006-03-03 21:50:58 +0000 | [diff] [blame] | 2263 | 2006-03-03 Scott James Remnant <scott@netsplit.com> |
| 2264 | |
| 2265 | * nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h: Formatting fixes, |
| 2266 | correct erroneous references to d_* functions and D* structures. |
| 2267 | * nih/list.h: Correct docstring for nih_list_new and nih_list_entry_new |
| 2268 | functions so that @data is described for the right one. |
| 2269 | * nih/Makefile.am: Add blank line between SOURCES and LDFLAGS. |
| 2270 | |
Scott James Remnant | dfb7d50 | 2005-09-29 06:06:03 +0100 | [diff] [blame] | 2271 | 2005-09-29 Scott James Remnant <scott@netsplit.com> |
| 2272 | |
| 2273 | * nih/alloc.c, nih/alloc.h, nih/list.c, nih/list.h: Fix docstring |
| 2274 | terminators to be **/ not */. |
| 2275 | * nih/alloc.h: Align function parameters. |
| 2276 | * nih/tests/test_alloc.c (test_alloc_set_name): Fix to return |
| 2277 | ret and not zero all the time. |
| 2278 | |
Scott James Remnant | 3b78a41 | 2005-08-29 10:46:19 +0100 | [diff] [blame] | 2279 | 2005-08-29 Scott James Remnant <scott@netsplit.com> |
| 2280 | |
Scott James Remnant | 7f28831 | 2005-08-29 11:48:04 +0100 | [diff] [blame] | 2281 | * nih/alloc.c (NIH_ALLOC_SMALLEST): Set to the size of the |
| 2282 | NihAllocCtx structure shifted left twice; this will divide evenly |
| 2283 | into a page. |
| 2284 | |
Scott James Remnant | 3b2cccb | 2005-08-29 11:33:11 +0100 | [diff] [blame] | 2285 | * nih/alloc.c (nih_alloc_init): No need to pass NULL to nih_list_new. |
| 2286 | (nih_alloc_new): No need to initialise data member of NihList structs |
| 2287 | or cast children member. |
| 2288 | (nih_alloc_named): Can cast NihList directly to NihAllocCtx now, |
| 2289 | simplify difference test. |
| 2290 | (nih_free): Use iter as variable name for clarity. |
| 2291 | (nih_alloc_return_unused): Cast NihList directly to NihAllocCtx. |
| 2292 | * nih/tests/test_alloc.c: Output "BAD:" instead of "FAIL:" |
| 2293 | |
Scott James Remnant | 35e2b4e | 2005-08-29 11:10:36 +0100 | [diff] [blame] | 2294 | * nih/list.h (NihList): Remove data pointer, it'll save us 4 bytes |
| 2295 | where we want to make lists of structures that are always in lists. |
| 2296 | (NihListEntry): Define new structure for those still wanting data |
| 2297 | pointers. |
| 2298 | (nih_list_add_new, nih_list_add_new_after): Use nih_list_entry_new. |
| 2299 | * nih/list.c (nih_list_new): Remove argument and don't initialise |
| 2300 | data pointer, this simply allocates and initialises the two-pointer |
| 2301 | structure. |
| 2302 | (nih_list_entry_new): New function to allocate and initialise an |
| 2303 | NihListEntry structure. |
| 2304 | * nih/tests/test_list.c: Output "BAD:" instead of "FAIL:" |
| 2305 | (test_new): Test without data pointer. |
| 2306 | (test_entry_new): Test with data pointer. |
| 2307 | (test_add, test_add_after, test_remove): Mix and cast NihList and |
| 2308 | NihListEntry properly. |
| 2309 | |
Scott James Remnant | 3b78a41 | 2005-08-29 10:46:19 +0100 | [diff] [blame] | 2310 | * nih/alloc.c: Implement a heirarchial allocator in a similar |
| 2311 | style to halloc and talloc, but designed never to return data to |
| 2312 | the system and re-use it instead. |
| 2313 | * nih/alloc.h: Prototypes and macros for allocator. |
| 2314 | * nih/libnih.h: Include allocator header. |
| 2315 | * nih/tests/test_alloc.c: Test-cases for allocator. |
| 2316 | * nih/macros.h (MIN, MAX): Define MIN and MAC macros if not already |
| 2317 | available. |
| 2318 | * nih/Makefile.am (libnih_la_SOURCES): Compile and link alloc.c |
| 2319 | (nihinclude_HEADERS): Install alloc.h |
| 2320 | (TESTS): Build and run the allocator test-cases. |
| 2321 | (test_alloc_SOURCES, alloc_list_LDADD): Identify the test sources and |
| 2322 | objects it needs. |
| 2323 | |
Scott James Remnant | c5e0539 | 2005-08-28 10:43:05 +0100 | [diff] [blame] | 2324 | 2005-08-28 Scott James Remnant <scott@netsplit.com> |
| 2325 | |
| 2326 | * nih/list.c (nih_list_init): Add new function for dealing with |
| 2327 | statically allocated list entries, and initialising them. |
| 2328 | (nih_list_new): Use nih_list_init() to initialise the list. |
| 2329 | (nih_list_new): Use nih_list_init() to re-initialise the list |
| 2330 | to a single-member. |
| 2331 | * nih/list.h: Add prototype for nih_list_init. |
| 2332 | (NihListIter): Remove the iterator structure, it turns |
| 2333 | out to be harder work to try and use lists in an "all nodes are |
| 2334 | interesting" manner; so we'll iterate them normally instead. |
| 2335 | (NIH_LIST_FIRST, NIH_LIST_LAST): Remove iterator test functions. |
| 2336 | (NIH_LIST_PREV, NIH_LIST_NEXT): Remove iterator change functions. |
| 2337 | * nih/tests/test_list.c: Use NULL for nih_list_new in all functions. |
| 2338 | (test_init): New test case for nih_list_init(). |
| 2339 | (test_iterator): Removed iterator tests. |
| 2340 | |
Scott James Remnant | 4ece665 | 2005-08-21 00:29:11 +0100 | [diff] [blame] | 2341 | 2005-08-21 Scott James Remnant <scott@netsplit.com> |
| 2342 | |
Scott James Remnant | 717f4a0 | 2005-08-21 22:37:06 +0100 | [diff] [blame] | 2343 | * nih/list.c: Add code for generic circular doubly-linked lists. |
| 2344 | * nih/list.h: Prototypes and macros. |
| 2345 | * nih/macros.h: Some generic macros. |
| 2346 | * nih/libnih.h: Header to import everything. |
| 2347 | * nih/tests/test_list.c: Test-cases for linked-list code. |
| 2348 | * nih/Makefile.am (libnih_la_SOURCES): Link list.c in. |
| 2349 | (nihincludedir): Define directory to contain header files to be |
| 2350 | $includedir/nih. |
| 2351 | (include_HEADERS): Install libnih.h into the main include directory. |
| 2352 | (nihinclude_HEADERS): Install header files. |
| 2353 | (TESTS): Build and run the list test-cases. |
| 2354 | (test_list_SOURCES, test_list_LDADD): Identify the test sources and |
| 2355 | objects it needs. |
| 2356 | |
Scott James Remnant | 4ece665 | 2005-08-21 00:29:11 +0100 | [diff] [blame] | 2357 | * nih/libnih.ver: Add simple "everything beginning nih_* is global" |
| 2358 | version script. |
| 2359 | * nih/Makefile.am (libnih_la_LDFLAGS): Use the version script |
| 2360 | if we can pass an argument to do that to the linker. |
| 2361 | (EXTRA_DIST): Distribute the version script. |
| 2362 | |
Scott James Remnant | ed1ca16 | 2005-07-09 00:00:47 +0100 | [diff] [blame] | 2363 | 2005-07-09 Scott James Remnant <scott@netsplit.com> |
| 2364 | |
Scott James Remnant | a5e7f30 | 2005-07-09 00:15:37 +0100 | [diff] [blame] | 2365 | * m4/compiler.m4 (NIH_COMPILER_WARNINGS): Macro to add -Wall, |
| 2366 | -Werror and -pedantic to CFLAGS and CXXFLAGS if using gcc or g++. |
| 2367 | (NIH_COMPILER_OPTIMISATIONS): Macro to remove any optimisation |
| 2368 | arguments from CFLAGS and CXXFLAGS and replace them with -O0 to |
| 2369 | override any default level. |
| 2370 | (NIH_COMPILER_COVERAGE): Macro to add compiler coverage testing |
| 2371 | arguments to CFLAGS and CXXFLAGS. |
| 2372 | * m4/linker.m4 (NIH_LINKER_OPTIMISATIONS): Macro to add -Wl,-O1 |
| 2373 | to LDFLAGS to increase the optimisation of the linker hash tables. |
| 2374 | (NIH_LINKER_VERSION_SCRIPT): Macro to test for the right argument |
| 2375 | to pass a version script to the linker and define |
| 2376 | HAVE_VERSION_SCRIPT and VERSION_SCRIPT_ARG. |
| 2377 | * m4/Makefile.am (dist_pkgdata_DATA): Ship macros. |
| 2378 | * configure.ac: Use new macros. |
| 2379 | |
Scott James Remnant | ed1ca16 | 2005-07-09 00:00:47 +0100 | [diff] [blame] | 2380 | * ChangeLog: Initial project infrastructure created. |
| 2381 | |