our <<conf:,configuration file parser>>. The <<conf:getopt_h,getopt>> module
has been obsoleted
* `<stdbool.h>` is automatically included by `<ucw/lib.h>`.
+* *Incompatible:* It turned out that almost all users of the growing array
+ module push/pop individual elements. Therefore, we have removed the second
+ argument (item count) of `GARY_PUSH` and `GARY_POP`. If you want to push/pop
+ multiple elements at once, use `GARY_PUSH_MULTI` and `GARY_POP_MULTI`.
* *Incompatible:* The interface of the <<heap:,heap>> module was cleaned up
to remove non-systematic side-effects. The `HEAP_INSERT` operation is now
a proper insert (previously, it was just cleanup after insertion performed
have been added.
* The fastbuf I/O layer received a new back-end <<fastbuf:fbmulti,fb_multi>>,
which concatenates several fastbuf streams to form a single virtual stream.
-* *Incompatible* The `UCW::CGI` Perl module has its custom error handlers
+* *Incompatible:* The `UCW::CGI` Perl module has its custom error handlers
(which override default Perl error handlers) split off to a separate module
`UCW::CGI::ErrorHandler`.
* Added <<varint:,varint>> module for efficient UTF-8-like encoding of 64-bit
a[i] = i+1;
}
- GARY_PUSH(a, 1);
- *GARY_PUSH(a, 1) = 10;
- *GARY_PUSH(a, 1) = 20;
- *GARY_PUSH(a, 1) = 30;
- GARY_POP(a, 1);
+ GARY_PUSH(a);
+ *GARY_PUSH(a) = 10;
+ *GARY_PUSH(a) = 20;
+ *GARY_PUSH(a) = 30;
+ GARY_POP(a);
GARY_FIX(a);
for (int i=0; i<(int)GARY_SIZE(a); i++)
#define GARY_RESIZE(ptr, n) ((ptr) = gary_set_size((ptr), (n)))
#define GARY_INIT_OR_RESIZE(ptr, n) (ptr) = (ptr) ? gary_set_size((ptr), (n)) : gary_init(sizeof(*(ptr)), (n), 0)
-#define GARY_PUSH(ptr, n) ({ \
+#define GARY_PUSH_MULTI(ptr, n) ({ \
struct gary_hdr *_h = GARY_HDR(ptr); \
typeof(*(ptr)) *_c = &(ptr)[_h->num_elts]; \
size_t _n = n; \
if (_h->num_elts > _h->have_space) \
(ptr) = gary_push_helper((ptr), _n, (byte **) &_c); \
_c; })
+#define GARY_PUSH(ptr) GARY_PUSH_MULTI(ptr, 1)
-#define GARY_POP(ptr, n) GARY_HDR(ptr)->num_elts -= (n)
+#define GARY_POP_MULTI(ptr, n) GARY_HDR(ptr)->num_elts -= (n)
+#define GARY_POP(ptr) GARY_POP_MULTI(ptr, 1)
#define GARY_FIX(ptr) (ptr) = gary_fix((ptr))
/* Internal functions */
HEAP_DELETE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index);
tm->index = 0;
tm->expires = 0;
- GARY_POP(m->timer_table, 1);
+ GARY_POP(m->timer_table);
}
else
{
return;
if (item->cls == OPT_CL_HELP) {
- struct help_line *l = GARY_PUSH(h->lines, 1);
+ struct help_line *l = GARY_PUSH(h->lines);
l->extra = item->help ? : "";
return;
}
if (item->letter >= OPT_POSITIONAL_TAIL)
return;
- struct help_line *first = GARY_PUSH(h->lines, 1);
+ struct help_line *first = GARY_PUSH(h->lines);
if (item->help) {
char *text = mp_strdup(h->pool, item->help);
struct help_line *l = first;
text = eol;
if (text)
- l = GARY_PUSH(h->lines, 1);
+ l = GARY_PUSH(h->lines);
}
}