[PATCH] calculate sizeof LANGUAGES_SIZE

Darshaka Pathirana dpat at syn-net.org
Tue Apr 15 13:26:23 CEST 2008


On 15.04.2008 13:23, Darshaka Pathirana wrote:
> # HG changeset patch
> # User Darshaka Pathirana <dpat at syn-net.org>
> # Date 1208258489 -7200
> # Node ID 72d3fcdfbb03fdcd68c36e424a89cf4ca236914f
> # Parent  6f8c11da3d1971d115c08dbb8f744af52a4b02ee
> calculate sizeof LANGUAGES_SIZE
> 
> diff -r 6f8c11da3d19 -r 72d3fcdfbb03 wengophone/src/model/config/Languages.h
> --- a/wengophone/src/model/config/Languages.h	Tue Apr 15 12:52:27 2008 +0200
> +++ b/wengophone/src/model/config/Languages.h	Tue Apr 15 13:21:29 2008 +0200
> @@ -33,9 +33,6 @@
>  	std::string englishName;
>  };
>  
> -/** Number of languages available. */
> -static const int LANGUAGES_SIZE = 251;
> -
>  /**
>   * List of all languages.
>   *
> @@ -52,7 +49,7 @@
>   * @see http://en.wikipedia.org/w/index.php?title=ISO_639
>   * @author Tanguy Krotoff
>   */
> -static const Language LANGUAGES[LANGUAGES_SIZE] = {
> +static const Language LANGUAGES[] = {
>  	{ "aa", "Afar", "Afar" },
>  	{ "ab", "Аҧсуа", "Abkhazian" },
>  	{ "af", "Afrikaans", "Afrikaans" },
> @@ -284,4 +281,6 @@
>  	{ "zu", "isiZulu", "Zulu" }
>  };
>  
> +static const int LANGUAGES_SIZE = sizeof (LANGUAGES) / sizeof (Language);
> +
>  #endif	//LANGUAGES_H

Seems to be better coding style to calculate the size of the array...
(thx again, Ralf Schlatterbeck for pointing out).

Any objections?

Greetings,
 - Darsha



More information about the QuteCom-dev mailing list