X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_arg.c;h=e7555f65a7c6669371c51e20b99c92f8934bf1fe;hp=e1fc20788b536a671d9f3d5ccefeaa82dcd7ffc8;hb=460005b642d978c6d4b48810803514bd36a6245b;hpb=a8987e73ec254703634802b4f7ee30d3a485524d diff --git a/form/fld_arg.c b/form/fld_arg.c index e1fc2078..e7555f65 100644 --- a/form/fld_arg.c +++ b/form/fld_arg.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,16 +33,16 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_fieldtype_arg( | FIELDTYPE *typ, | void * (* const make_arg)(va_list *), | void * (* const copy_arg)(const void *), | void (* const free_arg)(void *) ) -| +| | Description : Connects to the type additional arguments necessary | for a set_field_type call. The various function pointer | arguments are: @@ -61,34 +62,43 @@ MODULE_ID("$Id: fld_arg.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_fieldtype_arg - (FIELDTYPE * typ, - void * (* const make_arg)(va_list *), - void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)) +set_fieldtype_arg(FIELDTYPE *typ, + void *(*const make_arg)(va_list *), + void *(*const copy_arg)(const void *), + void (*const free_arg) (void *)) { - if ( !typ || !make_arg ) - RETURN(E_BAD_ARGUMENT); + TR_FUNC_BFR(3); + + T((T_CALLED("set_fieldtype_arg(%p,%s,%s,%s)"), + (void *)typ, + TR_FUNC_ARG(0, make_arg), + TR_FUNC_ARG(1, copy_arg), + TR_FUNC_ARG(2, free_arg))); - typ->status |= _HAS_ARGS; - typ->makearg = make_arg; - typ->copyarg = copy_arg; - typ->freearg = free_arg; - RETURN(E_OK); + if (typ != 0 && make_arg != (void *)0) + { + SetStatus(typ, _HAS_ARGS); + typ->makearg = make_arg; + typ->copyarg = copy_arg; + typ->freearg = free_arg; + RETURN(E_OK); + } + RETURN(E_BAD_ARGUMENT); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : void *field_arg(const FIELD *field) -| +| | Description : Retrieve pointer to the fields argument structure. | | Return Values : Pointer to structure or NULL if none is defined. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -field_arg (const FIELD * field) +field_arg(const FIELD *field) { - return Normalize_Field(field)->arg; + T((T_CALLED("field_arg(%p)"), (const void *)field)); + returnVoidPtr(Normalize_Field(field)->arg); } /* fld_arg.c ends here */