Added G_N_ELEMENTS macro to determine the number of elements in an array.

Fri Jan 21 10:18:24 2000  Owen Taylor  <otaylor@redhat.com>

	* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
	the number of elements in an array.
This commit is contained in:
Owen Taylor 2000-01-21 15:27:39 +00:00 committed by Owen Taylor
parent 9bee3ef88d
commit 948f64a183
10 changed files with 50 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

View File

@ -1,3 +1,8 @@
Fri Jan 21 10:18:24 2000 Owen Taylor <otaylor@redhat.com>
* glib.h (G_N_ELEMENTS): Added G_N_ELEMENTS macro to determine
the number of elements in an array.
Sun Jan 9 13:28:36 2000 Tim Janik <timj@gtk.org>
* gstrfuncs.c (g_strtod): correctly fetch the current locale,

5
glib.h
View File

@ -134,6 +134,11 @@ extern "C" {
#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
#define G_STRINGIFY_ARG(contents) #contents
/* Count the number of elements in an array. The array must be defined
* as such; using this with a dynamically allocated array will give
* incorrect results.
*/
#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
/* Define G_VA_COPY() to do the right thing for copying va_list variables.
* glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.

View File

@ -134,6 +134,11 @@ extern "C" {
#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
#define G_STRINGIFY_ARG(contents) #contents
/* Count the number of elements in an array. The array must be defined
* as such; using this with a dynamically allocated array will give
* incorrect results.
*/
#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
/* Define G_VA_COPY() to do the right thing for copying va_list variables.
* glibconfig.h may have already defined G_VA_COPY as va_copy or __va_copy.