<p>Another way might be like:</p>

<div class="highlight highlight-source-c"><pre>#<span class="pl-k">define</span> <span class="pl-en">ADD_KB_CUSTOM_COMMAND</span>(<span class="pl-v">n, key, mod</span>) \
    <span class="pl-en">add_kb</span>(group, GEANY_KEYS_FORMAT_SENTOCMD##n, <span class="pl-c1">NULL</span>, key, mod, \
        <span class="pl-s"><span class="pl-pds">"</span>edit_sentocmd<span class="pl-pds">"</span></span>#n, _(<span class="pl-s"><span class="pl-pds">"</span>Send to Custom Command <span class="pl-pds">"</span></span>#n), NULL)</pre></div>

<p>Not sure if that works for gettext scanning or translations though. Alternatively, we could use <code>g_intern_string()</code> which will copy the given string, then we can free our formatted one, to avoid "leaking" it like:</p>

<div class="highlight highlight-source-c"><pre>#<span class="pl-k">define</span> <span class="pl-en">ADD_KB_CUSTOM_COMMAND</span>(<span class="pl-v">n, key, mod</span>) \
    <span class="pl-k">do</span> { \
        gchar *label = <span class="pl-c1">g_strdup_printf</span>(<span class="pl-c1">_</span>(<span class="pl-s"><span class="pl-pds">"</span>Send to Custom Command <span class="pl-c1">%d</span><span class="pl-pds">"</span></span>), n); \
        <span class="pl-c1">add_kb</span>(group, GEANY_KEYS_FORMAT_SENDTOCMD##n, <span class="pl-c1">NULL</span>, key, mod, \
                <span class="pl-s"><span class="pl-pds">"</span>edit_sendtocmd<span class="pl-pds">"</span></span>#n, <span class="pl-c1">g_intern_string</span>(label), <span class="pl-c1">NULL</span>); \
        <span class="pl-c1">g_free</span>(label); \
    } <span class="pl-k">while</span>(<span class="pl-c1">0</span>)</pre></div>

<p>Or just leak them...</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, <a href="https://github.com/geany/geany/pull/1058#issuecomment-224773699">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/ABDrJ6bctk_W5zUUIHRQQBIOVf1vg-YGks5qJ2L8gaJpZM4IxerS">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJwAdfZ0naSyjBfKzria4xE38yRJTks5qJ2L8gaJpZM4IxerS.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/1058#issuecomment-224773699"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>