MCPcopy Create free account
hub / github.com/MariaDB/server / escape_string

Function escape_string

plugin/server_audit/server_audit.cc:1318–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1316
1317
1318static size_t escape_string(const char *str, unsigned int len,
1319 char *result, size_t result_len)
1320{
1321 const char *res_start= result;
1322 const char *res_end= result + result_len - 2;
1323 while (len)
1324 {
1325 char esc_c;
1326
1327 if (result >= res_end)
1328 break;
1329 if ((esc_c= escaped_char(*str)))
1330 {
1331 if (result+1 >= res_end)
1332 break;
1333 *(result++)= '\\';
1334 *(result++)= esc_c;
1335 }
1336 else if (is_space(*str))
1337 *(result++)= ' ';
1338 else
1339 *(result++)= *str;
1340 str++;
1341 len--;
1342 }
1343 *result= 0;
1344 return result - res_start;
1345}
1346
1347/*
1348 Replace "password" with "*****" in

Callers 1

log_statement_exFunction · 0.70

Calls 2

escaped_charFunction · 0.85
is_spaceFunction · 0.85

Tested by

no test coverage detected