<p>In <a href="https://github.com/geany/geany/pull/957#discussion_r62078649">tagmanager/src/tm_parser.c</a>:</p>
<pre style='color:#555'>> +};
> +
> +/* not in universal-ctags */
> +static TMParserMapEntry powershell_map[] = {
> +  {'f', tm_tag_function_t},
> +  {'v', tm_tag_variable_t},
> +};
> +
> +
> +typedef struct
> +{
> +    TMParserMapEntry *entries;
> +    guint size;
> +} TMParserMap;
> +
> +#define MAP_ENTRY(map) {map, (sizeof(map)/sizeof(TMParserMapEntry))}
</pre>
<blockquote>
<p>Could do the macro stuff you suggest too, just to me it usually takes more time to decode what macros with ## do than not using such features ;-).</p>
</blockquote>

<p>It sure hides some logic, but OTOH it can avoid typos in repetitive code, as well as making it easier to change it.<br>
In this case, instead of doing <code>[TM_PARSER_C] = { map_C, G_N_ELEMENTS(map_C) }</code> we get <code>MAP_ENTRY(C)</code>, which, IMO, is worth it, esp. as it's very repetitive.</p>

<p>BTW, I see I made a typo in my previous post's macro, missing the <code>TM_PARSER_##</code> prefix to <code>lang</code>.</p>

<blockquote>
<p>After posting the patch I realized it would be probably nicer instead of doing […]</p>
</blockquote>

<p>Indeed.  Can even be a simple <code>#define map_CPP map_C</code> avoiding any actual data duplication.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/geany/geany/pull/957/files/aea7d7845917843dd6b02e5a8dc9031cabc87a86..5d9376ea801a6e6c3ec22748741362a3a2eff7ac#r62078649">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ4cP1ehPLPxLnP4uVBBsG1jZq_65ks5p-NU0gaJpZM4Ht-Ad.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/957/files/aea7d7845917843dd6b02e5a8dc9031cabc87a86..5d9376ea801a6e6c3ec22748741362a3a2eff7ac#r62078649"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>