18.2.226. PMIx_Argv_prepend_nosize
PMIx_Argv_prepend_nosize — Insert a copy of a string at the front
of a NULL-terminated argv-style array.
18.2.226.1. SYNOPSIS
#include <pmix.h>
pmix_status_t PMIx_Argv_prepend_nosize(char ***argv, const char *arg);
18.2.226.1.1. Python Syntax
No Python equivalent
18.2.226.2. INPUT/OUTPUT PARAMETERS
argv: Address of a pointer to a NULL-terminatedargv-style array. On input,*argvmay beNULL(in which case a new array is created) or point to an existing array. On output,*argvis updated to point at the (possibly reallocated) array.
18.2.226.3. INPUT PARAMETERS
arg: The string to prepend. The routine stores a private copy; the caller retains ownership ofarg.
18.2.226.4. DESCRIPTION
Insert the string arg at position zero of the array referenced by
*argv, shifting every existing entry up by one position.
If *argv is NULL, a new two-element array is allocated holding a copy
of arg followed by the terminating NULL. If *argv already points
to an array, the array is reallocated one entry larger, the existing entries
are moved down one slot to make room, and a copy of arg (made with
strdup) is stored in element zero. *argv is updated to the resulting
array pointer, which the caller must use in place of any prior value because
reallocation may move the array.
This routine is the front-insertion counterpart to PMIx_Argv_append_nosize(3).
18.2.226.5. RETURN VALUE
Returns one of:
PMIX_SUCCESSThe string was prepended successfully.PMIX_ERR_OUT_OF_RESOURCEMemory could not be allocated for the array.
18.2.226.6. EXAMPLES
char **argv = NULL;
PMIx_Argv_append_nosize(&argv, "b");
PMIx_Argv_prepend_nosize(&argv, "a");
/* argv == { "a", "b", NULL } */
PMIx_Argv_free(argv);