1
2007-10-08 Scott James Remnant <scott@netsplit.com>
3
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.16.1 since this
4
version of gettext is needed for compatibility with Automake 1.10
5
* HACKING: Bump version in the docs too.
7
* Makefile.am (ACLOCAL_AMFLAGS): Specify that aclocal install
8
ordinarily system-wide macros into m4 (libtool.m4, specifically).
9
This makes it easier for packagers to modify autoconfery since
10
aclocal is no longer a destructive event.
11
* configure.ac (AM_INIT_AUTOMAKE): Increase Automake requirement to
12
1.10 to ensure we have aclocal --instal
13
* HACKING: Increase Automake version in the docs.
15
2007-06-22 Scott James Remnant <scott@netsplit.com>
17
* nih/tests/test_tree.c (test_next, test_prev, test_next_pre)
18
(test_prev_pre, test_next_post, test_pre_post): Add tests for a
19
single-node tree, because we found a bug where it didn't work.
20
* nih/tree.c (nih_tree_next): Bug fix; check there is a right node
21
before checking whether we've returned from it, otherwise we could
22
confuse it with starting at the top of the tree.
23
(nih_tree_prev): Likewise check there is a left node before checking
24
whether we've returned from it.
26
2007-06-20 Scott James Remnant <scott@netsplit.com>
28
* nih/config.c (nih_config_parse_stanza): Free name after use.
30
* nih/config.c (nih_config_parse_stanza): Don't dequote stanza
31
names, since otherwise they can't be made non-special; if we don't
32
recognise the stanza we parsed, raise the error without updating
33
pos, since we want it to point to the start of the token.
34
* nih/tests/test_config.c (test_parse_stanza): Update pos in test.
36
2007-06-18 Scott James Remnant <scott@netsplit.com>
38
* nih/list.h (NihListEntry): Define structure combining an NihList
39
with a union of common types.
40
* nih/list.c (nih_list_entry_new): Add a helper function for when
41
we need a simple entry without any extra structure around it.
42
* nih/tests/test_list.c (test_entry_new): Test the new function.
43
* nih/tree.h (NihTreeEntry): Define structure combining an NihTree
44
with a union of common types.
45
* nih/tree.c (nih_tree_entry_new): Add a helper function for when
46
we need a simple node without any extra structure around it.
47
* nih/tests/test_tree.c (test_entry_new): Test the new function.
49
2007-06-15 Scott James Remnant <scott@netsplit.com>
51
* nih/tests/test_tree.c (test_next, test_foreach, test_prev)
52
(test_next_pre, test_foreach_pre, test_prev_pre, test_next_post)
53
(test_foreach_post, test_prev_post): Add tests for partial tree
54
traversal, we don't expect to break out of the confines of the
55
root that we've set, even if it has a parent.
56
* nih/tree.c (nih_tree_next, nih_tree_prev, nih_tree_next_pre)
57
(nih_tree_prev_pre, nih_tree_next_post, nih_tree_prev_post): Before
58
moving up to the parent node, check whether the current node is the
59
tree root; if it is, return NULL instead since we've iterated the
60
sub-tree we were looking at.
62
* nih/tests/test_tree.c (test_next, test_foreach, test_prev)
63
(test_next_pre, test_foreach_pre, test_prev_pre, test_next_post)
64
(test_foreach_post, test_prev_post): Use two different arrays to
65
make it really obvious how the tree is constructed and what order
66
we really expect it to be in. This makes it easier to get ready for
69
* nih/tree.c (nih_tree_next, nih_tree_prev): Minor bug fix, set the
70
previous to the tree's parent when visiting for the first time so that
71
partial tree iterations might be able to work. Make algorithm code
72
simpler and more readable.
73
(nih_tree_next_pre, nih_tree_prev_pre): Algorithm for non-recursive
74
pre-order tree iteration, note that unlike the above, these are not
76
(nih_tree_next_post, nih_tree_prev_post): Algorithm for non-recursive
77
post-order tree iteration, note that these aren't symmetrical with
78
each other, but are the symmetrical equivalents of the pre-order
80
* nih/tree.h: Add prototypes for new functions.
81
(NIH_TREE_FOREACH_PRE, NIH_TREE_FOREACH_POST): Add convenience
82
iteration macros for pre-order and post-order iteration.
83
* nih/tests/test_tree.c (test_next, test_foreach, test_prev): Add
84
some documentation for the tree shape, and how we work out the node
85
numbers. In each case, we were accidentally giving the expected
86
first node (which fortunately always worked); to test this harder,
87
give the root node instead!
88
(test_next_pre, test_foreach_pre, text_prev_pre): Test pre-order
89
tree iteration with the same basic code.
90
(test_next_post, test_foreach_post, text_prev_post): Test post-order
91
tree iteration with the same basic code.
93
2007-06-12 Scott James Remnant <scott@netsplit.com>
95
* nih/test.h (TEST_HASH_NOT_EMPTY): Add missing ;
97
* nih/main.c (nih_main_unlink_pidfile): Add for completeness.
98
* nih/main.h: Add prototype.
99
* nih/tests/test_main.c: Use the new function here for testing.
101
* nih/main.c (nih_main_pidfile): Rename to nih_main_write_pidfile
102
(nih_main_set_pidfile, nih_main_get_pidfile)
103
(nih_main_read_pidfile): Add companion functions to set and get the
104
current location, and also read from it.
105
* nih/main.h: Add prototypes.
106
* nih/tests/test_main.c (test_set_pidfile, test_read_pidfile)
107
(test_write_pidfile): Test the functions as best we can.
109
* nih/main.c (nih_main_daemonise): Cut the pid file writing out
110
(nih_main_pidfile): and place it into its own function, since we
111
seem to use this elsewhere too.
112
* nih/main.h: add prototype.
114
* nih/main.c (nih_main_daemonise): Don't just write the pid file
115
directly, and hope it works. Write to a temporary file, flush and
116
sync it, then rename to the real filename. This provides a "if the
117
pid file exists, a pid can be read from it" contract - or at least,
118
the nearest we can to that.
120
2007-06-11 Scott James Remnant <scott@netsplit.com>
122
* nih/config.c (nih_config_skip_block): Simple function to skip over
123
a block inline without parsing it into a string.
124
* nih/config.h: Add prototype.
125
* nih/tests/test_config.c (test_skip_block): Test the new function.
127
2007-06-10 Scott James Remnant <scott@netsplit.com>
129
* nih/test.h (TEST_HASH_EMPTY, TEST_HASH_NOT_EMPTY): Add some
130
tests for hash emptyness.
132
2007-06-03 Scott James Remnant <scott@netsplit.com>
134
* nih/file.h (NihFileFilter): add missing data pointer to definition.
135
* nih/file.c (nih_dir_walk_scan): Take the data pointer and pass it
136
to the filter function.
137
(nih_dir_walk, nih_dir_walk_visit): Pass data pointer to scan function.
138
(nih_file_ignore): Accept and ignore a data pointer.
139
* nih/tests/test_file.c (my_filter): Add data pointer.
140
(test_ignore): Pass NULL for data pointer.
141
* nih/watch.c (nih_watch_handle): Pass data to filter function.
142
* nih/tests/test_watch.c (my_filter): Add data pointer.
144
2007-05-27 Scott James Remnant <scott@netsplit.com>
146
* nih/config.c (nih_config_parse): Since we've elimated all of the
147
uses of ssize_t in this code, we're safe to parse a file larger
148
than SSIZE_MAX, so drop the check.
149
* nih/errors.h (NIH_CONFIG_TOO_LONG): Drop this error, since there
150
can be no such case anymore; technically we don't handle very large
151
files since we can only map 4GB of memory, but we fail by mapping
152
a smaller part of the file, rather than overrunning any buffers.
154
* nih/config.c (nih_config_parse_block): Don't use -1 in ws to
155
indicate we've not counted it yet, instead use the current value
156
of lines; this elimates the last ssize_t from the code.
158
* nih/config.c (nih_config_block_end): Modify to return TRUE or
159
FALSE, and set the end position through an argument instead.
160
(nih_config_parse_block): Update the way we call nih_config_block_end
161
to receive the end location via the pointer, rather than as the
164
* nih/config.c (nih_config_token): Change return value to an int,
165
and return the token length through an argument pointer if given.
166
This eliminates a need for ssize_t for this function.
167
(nih_config_next_token, nih_config_parse_command): Update way we
168
call nih_config_token to obtain the length through a pointer, and
169
directly check the return value to decide whether to abandon it.
170
* nih/config.h: Update prototype.
171
* nih/tests/test_config.c (test_token): Update the tests to check
172
the pointed value for the length, and the return value for error.
174
2007-05-18 Scott James Remnant <scott@netsplit.com>
176
* nih/tests/test_string.c (test_array_append): Make sure that the
177
array is returned unaltered (at least, apparently) if any allocation
178
fails during the append.
179
* nih/string.c (nih_str_array_append): Record the original length,
180
and pass always pass our local length variable to nih_str_array_add.
181
Before returning, overwrite the returned length; if any allocation
182
fails, unwind other allocations and restore the NULL pointer before
185
* nih/string.c (nih_str_array_copy, nih_str_array_append): Add a
186
couple of functions to copy a string array, and to append one onto
187
the end of another. Saves reimplementing this each time.
188
* nih/string.h: Add prototypes.
189
* nih/tests/test_string.c (test_array_copy, test_array_append):
190
Test the new functions.
192
2007-04-24 Scott James Remnant <scott@netsplit.com>
194
* nih/string.c (nih_vsprintf): Add va_end to va_copy; C standard
197
2007-03-13 Scott James Remnant <scott@netsplit.com>
199
* nih/tests/test_io.c (test_get_family): The elmos of this world
200
like to disable various networking protocols, so expect that and
203
* nih/io.h: Change int_data type to a plain old int; there's no
204
reason for it to be a fixed width type, and we may as well think
205
about supporting ILP64 in case someone does something silly one day.
1
207
2007-03-11 Scott James Remnant <scott@netsplit.com>
3
209
* m4/compiler.m4: Don't check for __thread unless --enable-threading