[dovecot-cvs] dovecot/src/lib strfuncs.c, 1.42, 1.43 strfuncs.h, 1.21, 1.22

cras at dovecot.org cras at dovecot.org
Sun Dec 26 11:09:28 EET 2004


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv26026/lib

Modified Files:
	strfuncs.c strfuncs.h 
Log Message:
Added strarray_length().



Index: strfuncs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/strfuncs.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- strfuncs.c	15 Aug 2004 03:40:31 -0000	1.42
+++ strfuncs.c	26 Dec 2004 09:09:25 -0000	1.43
@@ -545,6 +545,19 @@
 	return _strsplit(data, separators, TRUE);
 }
 
+unsigned int strarray_length(const char *const *arr)
+{
+	unsigned int count;
+
+	if (arr == NULL)
+		return 0;
+
+	for (count = 0; *arr != NULL; arr++)
+		count++;
+
+	return count;
+}
+
 const char *dec2str(uintmax_t number)
 {
 	char *buffer;

Index: strfuncs.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/strfuncs.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- strfuncs.h	15 Aug 2004 03:40:31 -0000	1.21
+++ strfuncs.h	26 Dec 2004 09:09:25 -0000	1.22
@@ -65,6 +65,9 @@
 
 const char *dec2str(uintmax_t number);
 
+/* Return length of NULL-terminated list string array */
+unsigned int strarray_length(const char *const *arr);
+
 /* INTERNAL */
 const char *_vstrconcat(const char *str1, va_list args, size_t *ret_len);
 



More information about the dovecot-cvs mailing list