On 15-10-21 14:47:16, Allan McRae wrote:
On 20/10/15 23:48, Pierre Neidhardt wrote:
+/** Build the `titles` array of localized titles and pad them with spaces so + * that they align with the longest title. Storage for strings is stack + * allocated and naively truncated to TITLE_MAXLEN characters. + */ +static void make_aligned_titles() +{ + int i; + size_t max = 0; + static const wchar_t *title_suffix = L" :"; + static const size_t title_suffix_len = sizeof(title_suffix); + wchar_t wbuf[ARRAYSIZE(titles)][TITLE_MAXLEN + title_suffix_len]; + size_t wlen[ARRAYSIZE(wbuf)]; + char *buf[ARRAYSIZE(wbuf)];
Why are you not using _T_MAX for all these array-size?
Just a nit: I express this way that wbuf should have the same size as titles. Similarly, wlen and buf size depends on wbuf size. Some might argue it's also more readable. When the reader sees _T_MAX she has to check what it is bound to. This makes the code a tad more resistant in case we changed the size of titles without using _T_MAX. We never know. -- Pierre Neidhardt The good die young -- because they see it's no use living if you've got to be good. -- John Barrymore