Skip to content

Instantly share code, notes, and snippets.

@tstarling
Created April 16, 2014 22:44
Show Gist options
  • Save tstarling/10939962 to your computer and use it in GitHub Desktop.
Save tstarling/10939962 to your computer and use it in GitHub Desktop.
lol
if (*type_spec == '*' || *type_spec == '+') {
int num_varargs = num_args + 1 - post_varargs;
/* eat up the passed in storage even if it won't be filled in with varargs */
varargs = va_arg(*va, zval ****);
n_varargs = va_arg(*va, int *);
type_spec++;
if (num_varargs > 0) {
int iv = 0;
auto tmp = ZendExecutionStack::getArg(i);
zval **p = &tmp;
*n_varargs = num_varargs;
/* allocate space for array and store args */
*varargs = (zval ***) safe_emalloc(num_varargs, sizeof(zval **), 0);
while (num_varargs-- > 0) {
(*varargs)[iv++] = p++;
}
/* adjust how many args we have left and restart loop */
num_args = num_args + 1 - iv;
i += iv;
continue;
} else {
*varargs = NULL;
*n_varargs = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment