From 179f35702ece13f4ab7fd1b331bef664834d8473 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 18 Mar 2019 18:38:47 +0100 Subject: Add _c versions of functions that otherwise return static buffers We have a habit of returning static buffers from some functions, particularly when generating some kind of string values. This is convenient in terms of memory management, but it comes at the expense of not being thread-safe, and not allowing for two calls of the related function within one printf() statement. Let's introduce _c suffix versions of those functions where the caller passes in a talloc context from which the output buffer shall be allocated. Change-Id: I8481c19b68ff67cfa22abb93c405ebcfcb0ab19b --- include/osmocom/core/socket.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/osmocom/core/socket.h') diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index 4f6ed72b..37b1eaef 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -68,6 +68,7 @@ int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto, char *osmo_sock_get_name(const void *ctx, int fd); const char *osmo_sock_get_name2(int fd); +char *osmo_sock_get_name2_c(const void *ctx, int fd); int osmo_sock_get_name_buf(char *str, size_t str_len, int fd); int osmo_sock_get_ip_and_port(int fd, char *ip, size_t ip_len, char *port, size_t port_len, bool local); int osmo_sock_get_local_ip(int fd, char *host, size_t len); -- cgit v1.2.3