MCPcopy Create free account
hub / github.com/Kitware/VTK / pj_chomp

Function pj_chomp

ThirdParty/libproj/vtklibproj/src/internal.cpp:152–188  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

150
151/*****************************************************************************/
152char *pj_chomp (char *c) {
153/******************************************************************************
154Strip pre- and postfix whitespace. Inline comments (indicated by '#') are
155considered whitespace.
156******************************************************************************/
157 size_t i, n;
158 char *comment;
159 char *start = c;
160
161 if (nullptr==c)
162 return nullptr;
163
164 comment = strchr (c, '#');
165 if (comment)
166 *comment = 0;
167
168 n = strlen (c);
169 if (0==n)
170 return c;
171
172 /* Eliminate postfix whitespace */
173 for (i = n - 1; (i > 0) && (isspace (c[i]) || ';'==c[i]); i--)
174 c[i] = 0;
175
176 /* Find start of non-whitespace */
177 while (0 != *start && (';'==*start || isspace (*start)))
178 start++;
179
180 n = strlen (start);
181 if (0==n) {
182 c[0] = 0;
183 return c;
184 }
185
186 memmove (c, start, n + 1);
187 return c;
188}
189
190
191

Callers 2

pj_shrinkFunction · 0.85
get_init_stringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected