[asterisk-commits] rizzo: branch rizzo/video_v2 r87533 - in /team/rizzo/video_v2: include/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 30 09:57:19 CDT 2007


Author: rizzo
Date: Tue Oct 30 09:57:19 2007
New Revision: 87533

URL: http://svn.digium.com/view/asterisk?view=rev&rev=87533
Log:
remove some useless arguments from internal stringfield calls:
the number of entries is only needed in a small number of places.

This is a trunk candidate, together with followup cleanups to this code.


Modified:
    team/rizzo/video_v2/include/asterisk/stringfields.h
    team/rizzo/video_v2/main/utils.c

Modified: team/rizzo/video_v2/include/asterisk/stringfields.h
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/include/asterisk/stringfields.h?view=diff&rev=87533&r1=87532&r2=87533
==============================================================================
--- team/rizzo/video_v2/include/asterisk/stringfields.h (original)
+++ team/rizzo/video_v2/include/asterisk/stringfields.h Tue Oct 30 09:57:19 2007
@@ -143,7 +143,6 @@
   \param mgr Pointer to the pool manager structure
   \param needed Amount of space needed for this field
   \param fields Pointer to the first entry of the field array
-  \param num_fields Number of fields in the array
   \return NULL on failure, an address for the field on success.
 
   This function will allocate the requested amount of space from
@@ -151,20 +150,19 @@
   an additional pool will be allocated.
 */
 ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, size_t needed,
-						ast_string_field *fields, int num_fields);
+						ast_string_field *fields);
 
 /*!
   \internal
   \brief Set a field to a complex (built) value
   \param mgr Pointer to the pool manager structure
   \param fields Pointer to the first entry of the field array
-  \param num_fields Number of fields in the array
   \param index Index position of the field within the structure
   \param format printf-style format string
   \return nothing
 */
 void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
-				    ast_string_field *fields, int num_fields,
+				    ast_string_field *fields,
 				    int index, const char *format, ...);
 
 /*!
@@ -172,7 +170,6 @@
   \brief Set a field to a complex (built) value
   \param mgr Pointer to the pool manager structure
   \param fields Pointer to the first entry of the field array
-  \param num_fields Number of fields in the array
   \param index Index position of the field within the structure
   \param format printf-style format string
   \param args va_list of the args for the format_string
@@ -180,7 +177,7 @@
   \return nothing
 */
 void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
-				    ast_string_field *fields, int num_fields,
+				    ast_string_field *fields,
 				    int index, const char *format, va_list a1, va_list a2);
 
 /*!
@@ -241,7 +238,7 @@
      if( __zz__[0] != 0 && __dlen__ <= strlen(__zz__) ) { \
 	   strcpy(__zz__, data); \
      } else { \
-       if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__ + 1, &(x)->__begin_field[0], ast_string_field_count(x)))) \
+       if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__ + 1, &(x)->__begin_field[0]))) \
 	       strcpy((char*)(x)->__begin_field[index], data); \
 	 } \
 	} \
@@ -258,7 +255,7 @@
 	   strcpy(__zz__, data); \
      } else { \
        ast_verbose("%s: ++++++allocating room for '%s' to replace '%s'\n", logstr, data, __zz__); \
-       if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__ + 1, &(x)->__begin_field[0], ast_string_field_count(x)))) \
+       if (((x)->__begin_field[index] = __ast_string_field_alloc_space(&(x)->__field_mgr, __dlen__ + 1, &(x)->__begin_field[0]))) \
 	       strcpy((char*)(x)->__begin_field[index], data); \
 	 } \
 	} \
@@ -289,7 +286,7 @@
   \return nothing
 */
 #define ast_string_field_index_build(x, index, fmt, args...) \
-	__ast_string_field_index_build(&(x)->__field_mgr, &(x)->__begin_field[0], ast_string_field_count(x), index, fmt, args)
+	__ast_string_field_index_build(&(x)->__field_mgr, &(x)->__begin_field[0], index, fmt, args)
 
 /*!
   \brief Set a field to a complex (built) value with prebuilt va_lists.
@@ -301,7 +298,7 @@
   \return nothing
 */
 #define ast_string_field_index_build_va(x, index, fmt, args1, args2) \
-	__ast_string_field_index_build_va(&(x)->__field_mgr, &(x)->__begin_field[0], ast_string_field_count(x), index, fmt, args1, args2)
+	__ast_string_field_index_build_va(&(x)->__field_mgr, &(x)->__begin_field[0], index, fmt, args1, args2)
 
 /*!
   \brief Set a field to a complex (built) value

Modified: team/rizzo/video_v2/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/main/utils.c?view=diff&rev=87533&r1=87532&r2=87533
==============================================================================
--- team/rizzo/video_v2/main/utils.c (original)
+++ team/rizzo/video_v2/main/utils.c Tue Oct 30 09:57:19 2007
@@ -1169,7 +1169,7 @@
 }
 
 ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr, size_t needed,
-						ast_string_field *fields, int num_fields)
+						ast_string_field *fields)
 {
 	char *result = NULL;
 
@@ -1190,7 +1190,7 @@
 }
 
 void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
-				    ast_string_field *fields, int num_fields,
+				    ast_string_field *fields,
 				    int index, const char *format, va_list ap1, va_list ap2)
 {
 	size_t needed;
@@ -1217,7 +1217,7 @@
 }
 
 void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
-				    ast_string_field *fields, int num_fields,
+				    ast_string_field *fields,
 				    int index, const char *format, ...)
 {
 	va_list ap1, ap2;
@@ -1225,7 +1225,7 @@
 	va_start(ap1, format);
 	va_start(ap2, format);		/* va_copy does not exist on FreeBSD */
 
-	__ast_string_field_index_build_va(mgr, fields, num_fields, index, format, ap1, ap2);
+	__ast_string_field_index_build_va(mgr, fields, index, format, ap1, ap2);
 
 	va_end(ap1);
 	va_end(ap2);




More information about the asterisk-commits mailing list