MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / ospTrim

Function ospTrim

modules/osp/sipheader.c:78–102  ·  view source on GitHub ↗

* Trim leading and trailing space * param source Source string * param buffer Destiantion string buffer * param bufsize Destination string buffer size */

Source from the content-addressed store, hash-verified

76 * param bufsize Destination string buffer size
77 */
78void ospTrim(
79 char* source,
80 char* buffer,
81 int bufsize)
82{
83 char* start = source;
84 char* end = NULL;
85
86 if(bufsize != 0) {
87 while(isspace(*start)) {
88 start++;
89 }
90
91 if(*start == 0) {
92 *buffer = '\0';
93 } else {
94 end = start + strlen(start) - 1;
95 while(isspace(*end)) {
96 *end = '\0';
97 end--;
98 }
99 snprintf(buffer, bufsize, "%s", start);
100 }
101 }
102}
103
104/*
105 * Get AVP value

Callers 1

ospGetAVPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected