diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2022-01-31 15:56:02 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2022-02-07 22:10:29 +0100 |
commit | 1633735e9b93e58a73a13849613fe56f57ca15a9 (patch) | |
tree | 889ff457b9fb1c1e90d3a67030be6e61a2d691e4 /include/osmocom/core | |
parent | f3270f246fd05e56e13bd95dffda0fb361567ab4 (diff) |
add osmo_quote_str_buf3, osmo_escape_str_buf3
There already are osmo_quote_str_buf() and osmo_quote_str_buf2(), same
for _escape_, but none of them return the snprintf() like string length.
A private function does, publish this in the API.
The returned chars_needed is required to accurately allocate sufficient
size in string functions that call osmo_quote_str/osmo_escape_str. I am
adding such in osmo-upf.git.
Related: SYS#5599
Change-Id: I05d75a40599e3133da099a11e8babaaad0e9493a
Diffstat (limited to 'include/osmocom/core')
-rw-r--r-- | include/osmocom/core/utils.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 327aa3df..eda0e399 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -157,10 +157,12 @@ size_t osmo_quote_cstr_buf(char *buf, size_t bufsize, const char *str, int in_le char *osmo_quote_cstr_c(void *ctx, const char *str, int in_len); const char *osmo_escape_str(const char *str, int len); +int osmo_escape_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_escape_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_escape_str_c(const void *ctx, const char *str, int in_len); const char *osmo_quote_str(const char *str, int in_len); +int osmo_quote_str_buf3(char *buf, size_t bufsize, const char *str, int in_len); char *osmo_quote_str_buf2(char *buf, size_t bufsize, const char *str, int in_len); const char *osmo_quote_str_buf(const char *str, int in_len, char *buf, size_t bufsize); char *osmo_quote_str_c(const void *ctx, const char *str, int in_len); |