GRPC C++  1.66.0
Functions
string_util.h File Reference
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>

Go to the source code of this file.

Functions

GPRAPI char * gpr_strdup (const char *src)
 String utility functions. More...
 
GPRAPI int gpr_asprintf (char **strp, const char *format,...) GPR_PRINT_FORMAT_CHECK(2
 printf to a newly-allocated string. More...
 

Function Documentation

◆ gpr_asprintf()

GPRAPI int gpr_asprintf ( char **  strp,
const char *  format,
  ... 
)

printf to a newly-allocated string.

The set of supported formats may vary between platforms.

On success, returns the number of bytes printed (excluding the final '\0'), and *strp points to a string which must later be destroyed with gpr_free().

On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined.

◆ gpr_strdup()

GPRAPI char* gpr_strdup ( const char *  src)

String utility functions.

Returns a copy of src that can be passed to gpr_free(). If allocation fails or if src is NULL, returns NULL.