logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

gd_array_len — returns the length of a CARRAY or SARRAY field in a Dirfile

Description

       The  gd_array_len() function queries a dirfile(5) database specified by dirfile and calculates the length
       of the CARRAY, CONST, STRING, or SARRAY field called field_code.  If field_code contains a  valid  repre‐
       sentation suffix, it will be ignored.

       The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3).

History

       The gd_carray_len() function appeared in GetData-0.7.0.  It was restricted to CONST and CARRAY entries.

       In GetData-0.9.0, this function was renamed to gd_array_len, and STRING entries were now valid  for  this
       function.

       Before GetData-0.10.0, this function could also fail with the error code GD_E_ALLOC.

       In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code.

Name

       gd_array_len — returns the length of a CARRAY or SARRAY field in a Dirfile

Return Value

       Upon  successful completion, gd_array_len() returns a positive integer indicating the array length of the
       field specified.  (The length of a CONST or a STRING field is always 1.) On error, it returns a negative-
       valued error code.  Possible error codes are:

       GD_E_BAD_CODE
               The field specified by field_code was not found in the database.

       GD_E_BAD_DIRFILE
               The supplied dirfile was invalid.

       GD_E_BAD_FIELD_TYPE
               The field specified by field_code was not of one of the field types listed above.

       The error code is also stored in the DIRFILE object and may be retrieved after this function  returns  by
       calling   gd_error(3).    A   descriptive  error  string  for  the  error  may  be  obtained  by  calling
       gd_error_string(3).

See Also

dirfile(5), gd_open(3), gd_error(3), gd_error_string(3)

Version 0.10.0                                  25 December 2016                                 gd_array_len(3)

Synopsis

#include<getdata.h>size_tgd_array_len(DIRFILE*dirfile,constchar*field_code);

See Also