* authorization. *
****************************************************************************/
/*
- * $Id: demo_menus.c,v 1.22 2008/02/09 18:09:26 tom Exp $
+ * $Id: demo_menus.c,v 1.24 2008/04/12 22:03:33 tom Exp $
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
static char *
strdup(char *s)
{
- char *p = (char *) malloc(strlen(s) + 1);
+ char *p = typeMalloc(char, strlen(s) + 1);
if (p)
strcpy(p, s);
return (p);
while ((c = wgetch(win)) == CTRL('T')) {
if (_nc_tracing) {
save_trace = _nc_tracing;
- _tracef("TOGGLE-TRACING OFF");
+ Trace(("TOGGLE-TRACING OFF"));
_nc_tracing = 0;
} else {
_nc_tracing = save_trace;
}
trace(_nc_tracing);
if (_nc_tracing)
- _tracef("TOGGLE-TRACING ON");
+ Trace(("TOGGLE-TRACING ON"));
}
#else
c = wgetch(win);
#if 0
if (count > 0) {
while (*ip) {
- _tracef("freeing item %d:%d", ip - menu_items(m), count);
+ Trace(("freeing item %d:%d", ip - menu_items(m), count));
free_item(*ip++);
}
}
&& sb.st_size != 0) {
unsigned size = sb.st_size;
unsigned j, k;
- char *blob = malloc(size + 1);
- CONST_MENUS char **list =
- (CONST_MENUS char **) calloc(sizeof(*list), size + 1);
+ char *blob = typeMalloc(char, size + 1);
+ CONST_MENUS char **list = typeCalloc(CONST_MENUS char *, size + 1);
- items = (ITEM **) calloc(sizeof(ITEM *), size + 1);
+ items = typeCalloc(ITEM *, size + 1);
if (blob != 0 && list != 0) {
FILE *fp = fopen(filename, "r");
if (fp != 0) {
}
if (ap == 0) {
count = SIZEOF(labels) - 1;
- items = (ITEM **) calloc(count + 1, sizeof(*items));
+ items = typeCalloc(ITEM *, count + 1);
ap = labels;
}
size_t need = 12;
for (n = 0; t_tbl[n].name != 0; n++)
need += strlen(t_tbl[n].name) + 2;
- buf = (char *) malloc(need);
+ buf = typeMalloc(char, need);
}
sprintf(buf, "0x%02x = {", tlevel);
if (tlevel == 0) {
newtrace |= t_tbl[item_index(*ip)].mask;
}
trace(newtrace);
- _tracef("trace level interactively set to %s", tracetrace(_nc_tracing));
+ Trace(("trace level interactively set to %s", tracetrace(_nc_tracing)));
(void) mvprintw(LINES - 2, 0,
"Trace level is %s\n", tracetrace(_nc_tracing));