title: Passing an ellipsis to another variadic function
body: <p>I have approximately 30 variadic functions. Each one accepts a path as the final argument, e.g.:</p>
  
  <pre><code>bool do_foo(struct *f, int q, const char *fmt, ...)
  </code></pre>
  
  <p>In each function, I have to check that the expanded format is less then or equal to a certain size. So, I find myself copy / pasting the same chunk of code to check for how many characters <code>vsnprintf()</code> didn't print, set <code>errno</code> accordingly and bail out of the write.</p>
  
  <p>What I would like to do is write a function to do this, which would return a statically allocated (expanded) string that is known to be a safe size, or newly initialized string on failure, which could be checked against NULL. The checks also have to determine if the string is an absolute or relative path, which influences the safe size of the string. It's a lot of duplicate code and it's starting to smell.</p>
  
  <p>Is there a way that I can pass the contents of the elipsis from my function's entry to another function? Or do I have to call <code>va_start()</code> first, and then pass the <code>va_list</code> to the helper function?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I am not at all opposed to passing the <code>va_list</code> to the helper, I just wanted to make sure that nothing else existed. It seems to me the compiler understands where the variadic arguments begin, so I was just curious if I could tell it to pass them along.</p>