Scroll to navigation

PMIX_ARGV_PREPEND_NOSIZE(3) OpenPMIx PMIX_ARGV_PREPEND_NOSIZE(3)

PMIx_Argv_prepend_nosize — Insert a copy of a string at the front of a NULL-terminated argv-style array.

SYNOPSIS

#include <pmix.h>
pmix_status_t PMIx_Argv_prepend_nosize(char ***argv, const char *arg);


Python Syntax

No Python equivalent

INPUT/OUTPUT PARAMETERS

•
argv: Address of a pointer to a NULL-terminated argv-style array. On input, *argv may be NULL (in which case a new array is created) or point to an existing array. On output, *argv is updated to point at the (possibly reallocated) array.

INPUT PARAMETERS

•
arg: The string to prepend. The routine stores a private copy; the caller retains ownership of arg.

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) <#man3-pmix-argv-append-nosize>.

RETURN VALUE

Returns one of:

  • PMIX_SUCCESS The string was prepended successfully.
  • PMIX_ERR_OUT_OF_RESOURCE Memory could not be allocated for the array.

EXAMPLES

char **argv = NULL;
PMIx_Argv_append_nosize(&argv, "b");
PMIx_Argv_prepend_nosize(&argv, "a");
/* argv == { "a", "b", NULL } */
PMIx_Argv_free(argv);


See also:

PMIx_Argv_append_nosize(3) <#man3-pmix-argv-append-nosize>, PMIx_Argv_append_unique_nosize(3) <#man3-pmix-argv-append-unique-nosize>, PMIx_Argv_count(3) <#man3-pmix-argv-count>, PMIx_Argv_copy(3) <#man3-pmix-argv-copy>, PMIx_Argv_free(3) <#man3-pmix-argv-free>


Copyright

2014-2026, OpenPMIx Community

September 27, 2026