]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - form/fld_arg.c
ncurses 6.1 - patch 20181110
[ncurses.git] / form / fld_arg.c
index 7e4eaaf7ddeee26359d2792acb69c87a52341e8e..7326b0a05dc1eca6bb363ff16d49a72ac7fe0f03 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
+ * Copyright (c) 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            *
 
 /****************************************************************************
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
- *   Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en             *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_arg.c,v 1.6 2002/07/06 15:33:27 juergen Exp $")
+MODULE_ID("$Id: fld_arg.c,v 1.14 2016/01/23 21:32:00 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:
@@ -62,34 +61,38 @@ MODULE_ID("$Id: fld_arg.c,v 1.6 2002/07/06 15:33:27 juergen 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);
+  T((T_CALLED("set_fieldtype_arg(%p,%p,%p,%p)"),
+     (void *)typ, TR_FUNC(make_arg), TR_FUNC(copy_arg), TR_FUNC(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 */