diff options
Diffstat (limited to 'form')
| -rw-r--r-- | form/Makefile.in | 28 | ||||
| -rw-r--r-- | form/fld_arg.c | 6 | ||||
| -rw-r--r-- | form/fld_attr.c | 6 | ||||
| -rw-r--r-- | form/fld_current.c | 12 | ||||
| -rw-r--r-- | form/fld_def.c | 30 | ||||
| -rw-r--r-- | form/fld_dup.c | 6 | ||||
| -rw-r--r-- | form/form.priv.h | 15 | ||||
| -rw-r--r-- | form/frm_data.c | 8 | ||||
| -rw-r--r-- | form/frm_driver.c | 91 | ||||
| -rw-r--r-- | form/frm_post.c | 6 | ||||
| -rw-r--r-- | form/frm_req_name.c | 6 | ||||
| -rw-r--r-- | form/frm_sub.c | 15 | ||||
| -rw-r--r-- | form/frm_win.c | 16 | ||||
| -rw-r--r-- | form/fty_enum.c | 53 | ||||
| -rw-r--r-- | form/fty_generic.c | 17 | ||||
| -rw-r--r-- | form/fty_int.c | 14 | ||||
| -rw-r--r-- | form/fty_num.c | 16 | ||||
| -rw-r--r-- | form/fty_regex.c | 8 |
18 files changed, 186 insertions, 167 deletions
diff --git a/form/Makefile.in b/form/Makefile.in index a950a3e8ae14..753e42faad72 100644 --- a/form/Makefile.in +++ b/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.72 2021/07/03 15:45:33 tom Exp $ +# $Id: Makefile.in,v 1.78 2025/10/25 17:58:52 tom Exp $ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,11 +47,14 @@ SHELL = @SHELL@ VPATH = @srcdir@ THIS = Makefile +@SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" + x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -61,7 +64,9 @@ libdir = @libdir@ includedir = @includedir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -110,7 +115,7 @@ LINK = $(LIBTOOL_LINK) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -151,10 +156,13 @@ all \ libs \ install :: $(AUTO_SRC) $(LIBRARIES) +check :: + @echo "no unit-test implemented" + sources : $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ # make copies to simplify include-paths while still keeping form's include @@ -201,6 +209,12 @@ distclean :: clean realclean :: distclean +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ +../include/ncurses_def.h \ +../include/term.h : + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) + ../include/mf_common.h \ ../include/eti.h : ( cd ../menu && $(MAKE) $@ ) diff --git a/form/fld_arg.c b/form/fld_arg.c index 2f6c47715ccd..7dc4ac32314d 100644 --- a/form/fld_arg.c +++ b/form/fld_arg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2018-2020,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.18 2020/12/11 22:05:24 tom Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.19 2024/12/07 23:00:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -75,7 +75,7 @@ set_fieldtype_arg(FIELDTYPE *typ, TR_FUNC_ARG(1, copy_arg), TR_FUNC_ARG(2, free_arg))); - if (typ != 0 && make_arg != (void *)0) + if (typ != NULL && make_arg != NULL) { SetStatus(typ, _HAS_ARGS); typ->makearg = make_arg; diff --git a/form/fld_attr.c b/form/fld_attr.c index 4ce6b1c52d60..7827d1c4931d 100644 --- a/form/fld_attr.c +++ b/form/fld_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_attr.c,v 1.15 2020/12/11 22:05:24 tom Exp $") +MODULE_ID("$Id: fld_attr.c,v 1.16 2024/12/07 23:01:42 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines @@ -47,7 +47,7 @@ FORM_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ {\ Normalize_Field( field );\ - if (field != 0) \ + if (field != NULL) \ { \ if ((field -> name) != attr)\ {\ diff --git a/form/fld_current.c b/form/fld_current.c index 264007ef59f3..fc958db159d3 100644 --- a/form/fld_current.c +++ b/form/fld_current.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.16 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: fld_current.c,v 1.17 2024/12/07 23:01:42 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,7 +54,7 @@ set_current_field(FORM *form, FIELD *field) int err = E_OK; T((T_CALLED("set_current_field(%p,%p)"), (void *)form, (void *)field)); - if (form == 0 || field == 0) + if (form == NULL || field == NULL) { RETURN(E_BAD_ARGUMENT); } @@ -117,11 +117,11 @@ FORM_EXPORT(int) unfocus_current_field(FORM *const form) { T((T_CALLED("unfocus_current_field(%p)"), (const void *)form)); - if (form == 0) + if (form == NULL) { RETURN(E_BAD_ARGUMENT); } - else if (form->current == 0) + else if (form->current == NULL) { RETURN(E_REQUEST_DENIED); } @@ -158,7 +158,7 @@ FORM_EXPORT(int) field_index(const FIELD *field) { T((T_CALLED("field_index(%p)"), (const void *)field)); - returnCode((field != 0 && field->form != 0) ? (int)field->index : -1); + returnCode((field != NULL && field->form != NULL) ? (int)field->index : -1); } /* fld_current.c ends here */ diff --git a/form/fld_def.c b/form/fld_def.c index 51bdc6485800..5251bfbef807 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.44 2021/03/27 23:49:53 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.46 2024/12/07 21:56:21 tom Exp $") /* this can't be readonly */ static FIELD default_field = @@ -87,14 +87,14 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { assert(err != 0 && ap != (va_list *)0); if ((typ->status & _LINKED_TYPE) != 0) { TypeArgument *p = typeMalloc(TypeArgument, 1); - if (p != 0) + if (p != NULL) { p->left = _nc_Make_Argument(typ->left, ap, err); p->right = _nc_Make_Argument(typ->right, ap, err); @@ -134,14 +134,14 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { assert(err != 0 && argp != 0); if ((typ->status & _LINKED_TYPE) != 0) { TypeArgument *p = typeMalloc(TypeArgument, 1); - if (p != 0) + if (p != NULL) { p->left = _nc_Copy_Argument(typ, argp->left, err); p->right = _nc_Copy_Argument(typ, argp->right, err); @@ -180,11 +180,11 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) FORM_EXPORT(void) _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) { - if (typ != 0 && (typ->status & _HAS_ARGS) != 0) + if (typ != NULL && (typ->status & _HAS_ARGS) != 0) { if ((typ->status & _LINKED_TYPE) != 0) { - if (argp != 0) + if (argp != NULL) { _nc_Free_Argument(typ->left, argp->left); _nc_Free_Argument(typ->right, argp->right); @@ -229,7 +229,7 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src) } else { - if (dst->type != 0) + if (dst->type != NULL) { dst->type->ref++; } @@ -249,7 +249,7 @@ FORM_EXPORT(void) _nc_Free_Type(FIELD *field) { assert(field != 0); - if (field->type != 0) + if (field->type != NULL) { field->type->ref--; _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); @@ -289,7 +289,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) nrow >= 0 && nbuf >= 0 && ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ - (New_Field = typeMalloc(FIELD, 1)) != 0) + (New_Field = typeMalloc(FIELD, 1)) != NULL) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = default_field; @@ -313,7 +313,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) size_t len; len = Total_Buffer_Size(New_Field); - if ((New_Field->buf = (FIELD_CELL *)malloc(len))) + if ((New_Field->buf = (FIELD_CELL *)malloc(len)) != NULL) { /* Prefill buffers with blanks and insert terminating zeroes between buffers */ @@ -360,13 +360,13 @@ free_field(FIELD *field) { RETURN(E_BAD_ARGUMENT); } - else if (field->form != 0) + else if (field->form != NULL) { RETURN(E_CONNECTED); } else if (field == field->link) { - if (field->buf != 0) + if (field->buf != NULL) free(field->buf); } else @@ -380,7 +380,7 @@ free_field(FIELD *field) } _nc_Free_Type(field); #if USE_WIDEC_SUPPORT - if (field->expanded != 0) + if (field->expanded != NULL) { int n; diff --git a/form/fld_dup.c b/form/fld_dup.c index e195df958877..33cf073b934e 100644 --- a/form/fld_dup.c +++ b/form/fld_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.18 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.19 2024/11/30 21:40:55 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -83,7 +83,7 @@ dup_field(FIELD *field, int frow, int fcol) size_t len; len = Total_Buffer_Size(New_Field); - if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20))) + if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20)) != NULL) { memcpy(New_Field->buf, field->buf, len); returnField(New_Field); diff --git a/form/form.priv.h b/form/form.priv.h index ad5af63ad807..57f92eb03164 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2024 Thomas E. Dickey * + * Copyright 2018-2024,2025 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.49 2024/02/24 12:17:31 tom Exp $ */ +/* $Id: form.priv.h,v 0.52 2025/11/01 20:16:03 tom Exp $ */ #ifndef FORM_PRIV_H #define FORM_PRIV_H 1 @@ -93,11 +93,11 @@ extern FORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; /* If form is NULL replace form argument by default-form */ #define Normalize_Form(form) \ - ((form) = (form != 0) ? (form) : _nc_Default_Form) + ((form) = (form != NULL) ? (form) : _nc_Default_Form) /* If field is NULL replace field argument by default-field */ #define Normalize_Field(field) \ - ((field) = (field != 0) ? (field) : _nc_Default_Field) + ((field) = (field != NULL) ? (field) : _nc_Default_Field) #if NCURSES_SP_FUNCS #define Get_Form_Screen(form) \ @@ -172,6 +172,9 @@ TypeArgument; #define C_ZEROS '\0' +#define MAX_DIGITS 64 +#define MaxDigits(n) ((n) > MAX_DIGITS ? MAX_DIGITS : ((n) > 0 ? (n) : 0)) + extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); @@ -260,7 +263,7 @@ extern FORM_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); int len; \ int n; \ wchar_t *list = _nc_Widen_String((char *)buffer, &len); \ - if (list != 0) \ + if (list != NULL) \ { \ result = TRUE; \ for (n = 0; n < len; ++n) \ @@ -278,7 +281,7 @@ extern FORM_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); blank = TRUE; \ result = (n + 1 >= width); \ } \ - else if (!ccheck(list[n], NULL)) \ + else if (!ccheck((int) list[n], NULL)) \ { \ result = FALSE; \ break; \ diff --git a/form/frm_data.c b/form/frm_data.c index 940c32db99c6..1fcb59fc9b9d 100644 --- a/form/frm_data.c +++ b/form/frm_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.21 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: frm_data.c,v 1.22 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,7 +54,7 @@ data_behind(const FORM *form) if (form && (form->status & _POSTED) && form->current) { - FIELD *field; + const FIELD *field; field = form->current; if (!Single_Line_Field(field)) @@ -141,7 +141,7 @@ data_ahead(const FORM *form) if (form && (form->status & _POSTED) && form->current) { - FIELD *field; + const FIELD *field; bool cursor_moved = FALSE; int pos; diff --git a/form/frm_driver.c b/form/frm_driver.c index 75656d69ea2a..276f97f4bbfd 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.135 2021/09/01 23:34:01 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.137 2024/12/07 21:57:21 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -313,7 +313,7 @@ cell_base(WINDOW *win, int y, int x) while (LEGALYX(win, y, x)) { - cchar_t *data = &(win->_line[y].text[x]); + const cchar_t *data = &(win->_line[y].text[x]); if (isWidecBase(CHDEREF(data)) || !isWidecExt(CHDEREF(data))) { @@ -387,7 +387,7 @@ NCURSES_INLINE static FIELD_CELL * Get_Start_Of_Data(FIELD_CELL *buf, int blen) { FIELD_CELL *p = buf; - FIELD_CELL *end = &buf[blen]; + const FIELD_CELL *end = &buf[blen]; assert(buf && blen >= 0); while ((p < end) && ISBLANK(*p)) @@ -429,7 +429,7 @@ NCURSES_INLINE static FIELD_CELL * Get_First_Whitespace_Character(FIELD_CELL *buf, int blen) { FIELD_CELL *p = buf; - FIELD_CELL *end = &p[blen]; + const FIELD_CELL *end = &p[blen]; assert(buf && blen >= 0); while ((p < end) && !ISBLANK(*p)) @@ -479,7 +479,7 @@ After_Last_Whitespace_Character(FIELD_CELL *buf, int blen) NCURSES_INLINE static void Adjust_Cursor_Position(FORM *form, const FIELD_CELL *pos) { - FIELD *field; + const FIELD *field; int idx; field = form->current; @@ -716,7 +716,7 @@ Field_Grown(FIELD *field, int amount) for (i = 0; i <= field->nbuf; i++) { FIELD_CELL *new_bp = Address_Of_Nth_Buffer(field, i); - FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen); + const FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen); for (j = 0; j < old_buflen; ++j) new_bp[j] = old_bp[j]; @@ -734,7 +734,7 @@ Field_Grown(FIELD *field, int amount) { WINDOW *new_window = newpad(field->drows, field->dcols); - if (new_window != 0) + if (new_window != NULL) { assert(form != (FORM *)0); if (form->w) @@ -802,7 +802,7 @@ static int Field_encloses(FIELD *field, int ry, int rx) { T((T_CALLED("Field_encloses(%p)"), (void *)field)); - if (field != 0 + if (field != NULL && field->frow <= ry && (field->frow + field->rows) > ry && field->fcol <= rx @@ -830,7 +830,7 @@ Field_encloses(FIELD *field, int ry, int rx) FORM_EXPORT(int) _nc_Position_Form_Cursor(FORM *form) { - FIELD *field; + const FIELD *field; WINDOW *formwin; if (!form) @@ -1005,7 +1005,7 @@ _nc_Refresh_Current_Field(FORM *form) static void Perform_Justification(FIELD *field, WINDOW *win) { - FIELD_CELL *bp; + const FIELD_CELL *bp; int len; bp = (Field_Has_Option(field, O_NO_LEFT_STRIP) @@ -1053,7 +1053,7 @@ Perform_Justification(FIELD *field, WINDOW *win) static void Undo_Justification(FIELD *field, WINDOW *win) { - FIELD_CELL *bp; + const FIELD_CELL *bp; int y, x; int len; @@ -1251,7 +1251,7 @@ Synchronize_Linked_Fields(FIELD *field) return (E_SYSTEM_ERROR); for (linked_field = field->link; - (linked_field != field) && (linked_field != 0); + (linked_field != field) && (linked_field != NULL); linked_field = linked_field->link) { int syncres; @@ -1458,7 +1458,7 @@ _nc_Unset_Current_Field(FORM *form) werase(form->w); Perform_Justification(field, form->w); if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) && - (form->w->_parent == 0)) + (form->w->_parent == NULL)) { copywin(form->w, Get_Form_Window(form), @@ -1480,7 +1480,7 @@ _nc_Unset_Current_Field(FORM *form) } delwin(form->w); form->w = (WINDOW *)0; - form->current = 0; + form->current = NULL; } /*--------------------------------------------------------------------------- @@ -1702,10 +1702,10 @@ IFN_Previous_Line(FORM *form) static int IFN_Next_Word(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); FIELD_CELL *s; - FIELD_CELL *t; + const FIELD_CELL *t; T((T_CALLED("IFN_Next_Word(%p)"), (void *)form)); @@ -1745,9 +1745,9 @@ static int IFN_Previous_Word(FORM *form) { FIELD *field = form->current; - FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); - FIELD_CELL *s; - FIELD_CELL *t; + const FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); + const FIELD_CELL *s; + const FIELD_CELL *t; bool again = FALSE; T((T_CALLED("IFN_Previous_Word(%p)"), (void *)form)); @@ -1845,7 +1845,7 @@ IFN_End_Of_Field(FORM *form) static int IFN_Beginning_Of_Line(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; T((T_CALLED("IFN_Beginning_Of_Line(%p)"), (void *)form)); Synchronize_Buffer(form); @@ -1869,7 +1869,7 @@ IFN_Beginning_Of_Line(FORM *form) static int IFN_End_Of_Line(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *pos; FIELD_CELL *bp; @@ -2009,7 +2009,7 @@ IFN_Down_Character(FORM *form) static int VSC_Generic(FORM *form, int nlines) { - FIELD *field = form->current; + const FIELD *field = form->current; int res = E_REQUEST_DENIED; int rows_to_go = (nlines > 0 ? nlines : -nlines); @@ -2189,7 +2189,7 @@ VSC_Scroll_Half_Page_Backward(FORM *form) static int HSC_Generic(FORM *form, int ncolumns) { - FIELD *field = form->current; + const FIELD *field = form->current; int res = E_REQUEST_DENIED; int cols_to_go = (ncolumns > 0 ? ncolumns : -ncolumns); @@ -2365,7 +2365,8 @@ NCURSES_INLINE static bool Is_There_Room_For_A_Line(FORM *form) { FIELD *field = form->current; - FIELD_CELL *begin_of_last_line, *s; + FIELD_CELL *begin_of_last_line; + const FIELD_CELL *s; Synchronize_Buffer(form); begin_of_last_line = Address_Of_Row_In_Buffer(field, (field->drows - 1)); @@ -2419,7 +2420,7 @@ Is_There_Room_For_A_Char_In_Line(FORM *form) | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ static int -Insert_String(FORM *form, int row, FIELD_CELL *txt, int len) +Insert_String(FORM *form, int row, const FIELD_CELL *txt, int len) { FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Row_In_Buffer(field, row); @@ -2450,7 +2451,7 @@ Insert_String(FORM *form, int row, FIELD_CELL *txt, int len) if (row < (field->drows - 1)) { - FIELD_CELL *split; + const FIELD_CELL *split; split = After_Last_Whitespace_Character(bp, @@ -2507,7 +2508,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form) (!Last_Row || Growable(field))) /* there are more lines */ { FIELD_CELL *bp; - FIELD_CELL *split; + const FIELD_CELL *split; int chars_to_be_wrapped; int chars_to_remain_on_line; @@ -2633,7 +2634,7 @@ static int FE_New_Line(FORM *form) { FIELD *field = form->current; - FIELD_CELL *bp, *t; + FIELD_CELL *bp; bool Last_Row = ((field->drows - 1) == form->currow); T((T_CALLED("FE_New_Line(%p)"), (void *)form)); @@ -2682,6 +2683,7 @@ FE_New_Line(FORM *form) } else { + const FIELD_CELL *t; bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form); if (!(May_Do_It || Growable(field))) @@ -2810,7 +2812,7 @@ FE_Delete_Character(FORM *form) static int FE_Delete_Previous(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; T((T_CALLED("FE_Delete_Previous(%p)"), (void *)form)); if (First_Position_In_Current_Field(form)) @@ -2818,7 +2820,8 @@ FE_Delete_Previous(FORM *form) if ((--(form->curcol)) < 0) { - FIELD_CELL *this_line, *prev_line, *prev_end, *this_end; + FIELD_CELL *this_line, *prev_line; + const FIELD_CELL *prev_end, *this_end; int this_row = form->currow; form->curcol++; @@ -2898,9 +2901,9 @@ FE_Delete_Line(FORM *form) static int FE_Delete_Word(FORM *form) { - FIELD *field = form->current; + const FIELD *field = form->current; FIELD_CELL *bp = Address_Of_Current_Row_In_Buffer(form); - FIELD_CELL *ep = bp + field->dcols; + const FIELD_CELL *ep = bp + field->dcols; FIELD_CELL *cp = bp + form->curcol; FIELD_CELL *s; @@ -4440,7 +4443,7 @@ form_driver(FORM *form, int c) { MEVENT event; WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form)); - WINDOW *sub = form->sub ? form->sub : win; + const WINDOW *sub = form->sub ? form->sub : win; getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -4641,7 +4644,7 @@ form_driver_w(FORM *form, int type, wchar_t c) { MEVENT event; WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form)); - WINDOW *sub = form->sub ? form->sub : win; + const WINDOW *sub = form->sub ? form->sub : win; getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -4755,7 +4758,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) int len; #if USE_WIDEC_SUPPORT - FIELD_CELL *widevalue = 0; + FIELD_CELL *widevalue = NULL; #endif T((T_CALLED("set_field_buffer(%p,%d,%s)"), (void *)field, buffer, _nc_visbuf(value))); @@ -4804,7 +4807,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) wclear(field->working); (void)mvwaddstr(field->working, 0, 0, value); - if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0) + if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == NULL) { RETURN(E_SYSTEM_ERROR); } @@ -4866,7 +4869,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value) FORM_EXPORT(char *) field_buffer(const FIELD *field, int buffer) { - char *result = 0; + char *result = NULL; T((T_CALLED("field_buffer(%p,%d)"), (const void *)field, buffer)); @@ -4887,14 +4890,14 @@ field_buffer(const FIELD *field, int buffer) size_t next; init_mb(state); - next = _nc_wcrtomb(0, data[n].chars[0], &state); + next = _nc_wcrtomb(NULL, data[n].chars[0], &state); if (next > 0) need += next; } } /* allocate a place to store the expanded string */ - if (field->expanded[buffer] != 0) + if (field->expanded[buffer] != NULL) free(field->expanded[buffer]); field->expanded[buffer] = typeMalloc(char, need + 1); @@ -4906,7 +4909,7 @@ field_buffer(const FIELD *field, int buffer) * contain embedded wide-character extensions). Change the null-padding * to blanks as needed. */ - if ((result = field->expanded[buffer]) != 0) + if ((result = field->expanded[buffer]) != NULL) { wclear(field->working); wmove(field->working, 0, 0); @@ -4934,8 +4937,8 @@ field_buffer(const FIELD *field, int buffer) FORM_EXPORT(wchar_t *) _nc_Widen_String(char *source, int *lengthp) { - wchar_t *result = 0; - wchar_t wch; + wchar_t *result = NULL; + wchar_t wch = 0; size_t given = strlen(source); size_t tries; int pass; @@ -4996,7 +4999,7 @@ _nc_Widen_String(char *source, int *lengthp) result = typeCalloc(wchar_t, need); *lengthp = (int)need; - if (result == 0) + if (result == NULL) break; } } diff --git a/form/frm_post.c b/form/frm_post.c index ab880894d925..a4f4f7d39dd4 100644 --- a/form/frm_post.c +++ b/form/frm_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: frm_post.c,v 1.15 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -51,7 +51,7 @@ MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $") FORM_EXPORT(int) post_form(FORM *form) { - WINDOW *formwin; + const WINDOW *formwin; int err; int page; diff --git a/form/frm_req_name.c b/form/frm_req_name.c index 8b76a8e4f542..6c98ace911c8 100644 --- a/form/frm_req_name.c +++ b/form/frm_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.23 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: frm_req_name.c,v 1.24 2024/12/07 23:00:37 tom Exp $") #define DATA(s) { s } @@ -153,7 +153,7 @@ form_request_by_name(const char *str) T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str))); - if (str != 0 && (i = strlen(str)) != 0) + if (str != NULL && (i = strlen(str)) != 0) { char buf[16]; /* longest name is 10 chars */ diff --git a/form/frm_sub.c b/form/frm_sub.c index 8f1de099cdf6..4fb00e7a789b 100644 --- a/form/frm_sub.c +++ b/form/frm_sub.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.15 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.16 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,9 +54,8 @@ set_form_sub(FORM *form, WINDOW *win) else { #if NCURSES_SP_FUNCS - FORM *f = Normalize_Form(form); - - f->sub = win ? win : StdScreen(Get_Form_Screen(f)); + (void) Normalize_Form(form); + form->sub = win ? win : StdScreen(Get_Form_Screen(form)); RETURN(E_OK); #else Normalize_Form(form)->sub = win; @@ -76,12 +75,10 @@ set_form_sub(FORM *form, WINDOW *win) FORM_EXPORT(WINDOW *) form_sub(const FORM *form) { - const FORM *f; - T((T_CALLED("form_sub(%p)"), (const void *)form)); - f = Normalize_Form(form); - returnWin(Get_Form_Window(f)); + (void) Normalize_Form(form); + returnWin(Get_Form_Window(form)); } /* frm_sub.c ends here */ diff --git a/form/frm_win.c b/form/frm_win.c index eeea27d37366..eb4982922b15 100644 --- a/form/frm_win.c +++ b/form/frm_win.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.19 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: frm_win.c,v 1.20 2024/07/27 18:35:02 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -54,9 +54,8 @@ set_form_win(FORM *form, WINDOW *win) else { #if NCURSES_SP_FUNCS - FORM *f = Normalize_Form(form); - - f->win = win ? win : StdScreen(Get_Form_Screen(f)); + (void) Normalize_Form(form); + form->win = win ? win : StdScreen(Get_Form_Screen(form)); RETURN(E_OK); #else Normalize_Form(form)->win = win; @@ -77,15 +76,14 @@ FORM_EXPORT(WINDOW *) form_win(const FORM *form) { WINDOW *result; - const FORM *f; T((T_CALLED("form_win(%p)"), (const void *)form)); - f = Normalize_Form(form); + (void) Normalize_Form(form); #if NCURSES_SP_FUNCS - result = (f->win ? f->win : StdScreen(Get_Form_Screen(f))); + result = (form->win ? form->win : StdScreen(Get_Form_Screen(form))); #else - result = (f->win ? f->win : stdscr); + result = (form->win ? form->win : stdscr); #endif returnWin(result); } diff --git a/form/fty_enum.c b/form/fty_enum.c index 16ffae11036f..59c3ff77a9d8 100644 --- a/form/fty_enum.c +++ b/form/fty_enum.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2024,2025 Thomas E. Dickey * * Copyright 1998-2009,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.33 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.36 2025/11/15 18:12:38 tom Exp $") typedef struct { @@ -104,7 +104,7 @@ Generic_Enum_Type(void *arg) argp->kwds = typeMalloc(char *, cnt + 1); kp = kwds; - if ((kptarget = argp->kwds) != 0) + if ((kptarget = argp->kwds) != NULL) { while (kp && (*kp)) { @@ -168,7 +168,7 @@ Copy_Enum_Type(const void *argp) char **kp = ap->kwds; result->kwds = typeMalloc(char *, 1 + ap->count); - if ((kptarget = result->kwds) != 0) + if ((kptarget = result->kwds) != NULL) { while (kp && (*kp)) { @@ -209,6 +209,7 @@ Free_Enum_Type(void *argp) } assert(cnt == ap->count); free(ap->kwds); + (void) cnt; } free(argp); } @@ -291,21 +292,21 @@ Check_Enum_Field(FIELD *field, const void *argp) char **kwds = ((const enumARG *)argp)->kwds; bool ccase = ((const enumARG *)argp)->checkcase; bool unique = ((const enumARG *)argp)->checkunique; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s, *t, *p; + const unsigned char *bp = (unsigned char *)field_buffer(field, 0); + const char *s, *t, *p; while (kwds && (s = (*kwds++))) { int res; - if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH) + if ((res = Compare((const unsigned char *)s, bp, ccase)) != NOMATCH) { p = t = s; /* t is at least a partial match */ if ((unique && res != EXACT)) { while (kwds && (p = *kwds++)) { - if ((res = Compare((unsigned char *)p, bp, ccase)) != NOMATCH) + if ((res = Compare((const unsigned char *)p, bp, ccase)) != NOMATCH) { if (res == EXACT) { @@ -313,7 +314,7 @@ Check_Enum_Field(FIELD *field, const void *argp) break; } else - t = (char *)0; + t = NULL; } } } @@ -347,12 +348,13 @@ Next_Enum(FIELD *field, const void *argp) { const enumARG *args = (const enumARG *)argp; char **kwds = args->kwds; - bool ccase = args->checkcase; - int cnt = args->count; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); + const unsigned char *bp = (const unsigned char *)field_buffer(field, 0); if (kwds) { + int cnt = args->count; + bool ccase = args->checkcase; + while (cnt--) { if (Compare((unsigned char *)(*kwds++), bp, ccase) == EXACT) @@ -386,26 +388,25 @@ Previous_Enum(FIELD *field, const void *argp) const enumARG *args = (const enumARG *)argp; int cnt = args->count; char **kwds = &args->kwds[cnt - 1]; + const unsigned char *bp = (const unsigned char *)field_buffer(field, 0); + bool ccase = args->checkcase; - unsigned char *bp = (unsigned char *)field_buffer(field, 0); - if (kwds) + while (cnt--) { - while (cnt--) - { - if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT) - break; - } + if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT) + break; + } - if (cnt <= 0) - kwds = &args->kwds[args->count - 1]; + if (cnt <= 0) + kwds = &args->kwds[args->count - 1]; - if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) - { - set_field_buffer(field, 0, *kwds); - return TRUE; - } + if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) + { + set_field_buffer(field, 0, *kwds); + return TRUE; } + return FALSE; } diff --git a/form/fty_generic.c b/form/fty_generic.c index 301c80a1f07a..443a7fe2055d 100644 --- a/form/fty_generic.c +++ b/form/fty_generic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 2008-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_generic.c,v 1.15 2021/03/27 23:49:53 tom Exp $") +MODULE_ID("$Id: fty_generic.c,v 1.17 2024/12/07 23:12:11 tom Exp $") /* * This is not a full implementation of a field type, but adds some @@ -170,7 +170,10 @@ GenericArgument(const FIELDTYPE *typ, { TypeArgument *res = (TypeArgument *)0; - if (typ != 0 && (typ->status & _HAS_ARGS) != 0 && err != 0 && argiterator != 0) + if (typ != NULL + && (typ->status & _HAS_ARGS) != 0 + && err != NULL + && argiterator != NULL) { if (typ->status & _LINKED_TYPE) { @@ -189,14 +192,14 @@ GenericArgument(const FIELDTYPE *typ, else { assert(typ->genericarg != (void *)0); - if (typ->genericarg == 0) + if (typ->genericarg == NULL) *err += 1; else { void *argp; int valid = argiterator(&argp); - if (valid == 0 || argp == 0 || + if (valid == 0 || argp == NULL || !(res = (TypeArgument *)typ->genericarg(argp))) { *err += 1; @@ -231,7 +234,7 @@ _nc_set_generic_fieldtype(FIELD *field, if (field) { - if (field && field->type) + if (field->type) _nc_Free_Type(field); field->type = ftyp; @@ -282,7 +285,7 @@ _nc_form_cursor(const FORM *form, int *pRow, int *pCol) int code = E_SYSTEM_ERROR; WINDOW *res = (WINDOW *)0; - if (form != 0 && pRow != 0 && pCol != 0) + if (form != NULL && pRow != NULL && pCol != NULL) { *pRow = form->currow; *pCol = form->curcol; diff --git a/form/fty_int.c b/form/fty_int.c index c7e3135c882b..7cd90bb020f5 100644 --- a/form/fty_int.c +++ b/form/fty_int.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020,2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.33 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: fty_int.c,v 1.36 2024/12/21 17:14:36 tom Exp $") #if USE_WIDEC_SUPPORT #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) @@ -73,7 +73,7 @@ static void * Generic_This_Type(void *arg) { thisARG *argp = (thisARG *)0; - thisARG *param = (thisARG *)arg; + const thisARG *param = (thisARG *)arg; if (param) { @@ -169,7 +169,7 @@ Check_This_Field(FIELD *field, const void *argp) long high = argi->high; int prec = argi->precision; unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s = (char *)bp; + const char *s = (char *)bp; bool result = FALSE; while (*bp == ' ') @@ -184,7 +184,7 @@ Check_This_Field(FIELD *field, const void *argp) int len; wchar_t *list = _nc_Widen_String((char *)bp, &len); - if (list != 0) + if (list != NULL) { bool blank = FALSE; int n; @@ -235,10 +235,10 @@ Check_This_Field(FIELD *field, const void *argp) } if (result) { - char buf[100]; + char buf[MAX_DIGITS + 3]; _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) - "%.*ld", (prec > 0 ? prec : 0), val); + "%.*ld", MaxDigits(prec), val); set_field_buffer(field, 0, buf); } } diff --git a/form/fty_num.c b/form/fty_num.c index 34cef6364bdb..9f03b2e6e3b3 100644 --- a/form/fty_num.c +++ b/form/fty_num.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2021 Thomas E. Dickey * + * Copyright 2019-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.37 2021/03/27 23:49:58 tom Exp $") +MODULE_ID("$Id: fty_num.c,v 1.40 2024/12/21 17:16:09 tom Exp $") #if HAVE_LOCALE_H #include <locale.h> @@ -84,7 +84,7 @@ static void * Generic_This_Type(void *arg) { thisARG *argn = (thisARG *)0; - thisPARM *args = (thisPARM *)arg; + const thisPARM *args = (thisPARM *)arg; if (args) { @@ -187,8 +187,8 @@ Check_This_Field(FIELD *field, const void *argp) double high = argn->high; int prec = argn->precision; unsigned char *bp = (unsigned char *)field_buffer(field, 0); - char *s = (char *)bp; - struct lconv *L = argn->L; + const char *s = (char *)bp; + const struct lconv *L = argn->L; bool result = FALSE; while (*bp == ' ') @@ -203,7 +203,7 @@ Check_This_Field(FIELD *field, const void *argp) int len; wchar_t *list = _nc_Widen_String((char *)bp, &len); - if (list != 0) + if (list != NULL) { bool blank = FALSE; int state = 0; @@ -273,10 +273,10 @@ Check_This_Field(FIELD *field, const void *argp) } if (result) { - char buf[64]; + char buf[MAX_DIGITS * 6]; _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) - "%.*f", (prec > 0 ? prec : 0), val); + "%.*f", MaxDigits(prec), val); set_field_buffer(field, 0, buf); } } diff --git a/form/fty_regex.c b/form/fty_regex.c index 62dcab58c352..66e7351e27dd 100644 --- a/form/fty_regex.c +++ b/form/fty_regex.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.33 2021/08/14 15:01:52 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.34 2024/12/07 23:02:27 tom Exp $") #if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2 /* We prefer POSIX regex */ @@ -157,12 +157,12 @@ Generic_RegularExpression_Type(void *arg MAYBE_UNUSED) if (preg) { T((T_CREATE("RegExp_Arg %p"), (void *)preg)); - if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0) + if (((preg->pRegExp = typeMalloc(regex_t, 1)) != NULL) && !regcomp(preg->pRegExp, rx, (REG_EXTENDED | REG_NOSUB | REG_NEWLINE))) { T((T_CREATE("regex_t %p"), (void *)preg->pRegExp)); - if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0) + if ((preg->refCount = typeMalloc(unsigned long, 1)) != NULL) *(preg->refCount) = 1; } else |
