Commit 8bee9c86c9c9324fef253d8f4f321bc53510844a
1 parent
ad7f27cd
Exists in
master
and in
3 other branches
Cleaning up unused code.
Showing
4 changed files
with
100 additions
and
98 deletions
Show diff stats
src/core/html.c
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
19 | 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 | * |
21 | - * Este programa está nomeado como html.c e possui - linhas de código. | |
21 | + * Este programa está nomeado como util.c e possui - linhas de código. | |
22 | 22 | * |
23 | 23 | * Contatos: |
24 | 24 | * | ... | ... |
src/core/resources.c
... | ... | @@ -40,13 +40,14 @@ |
40 | 40 | |
41 | 41 | extern String fallbacks[]; |
42 | 42 | |
43 | -/* s3270 substitute Xt resource database. */ | |
44 | - | |
45 | -#if defined(C3270) /*[*/ | |
46 | 43 | /* |
47 | - * These should be properly #ifdef'd in X3270.xad, but it would turn it into | |
48 | - * spaghetti. | |
49 | - */ | |
44 | +// s3270 substitute Xt resource database. | |
45 | + | |
46 | +#if defined(C3270) | |
47 | +// | |
48 | +// These should be properly #ifdef'd in X3270.xad, but it would turn it into | |
49 | +// spaghetti. | |
50 | +// | |
50 | 51 | static struct { |
51 | 52 | char *name; |
52 | 53 | char *value; |
... | ... | @@ -96,12 +97,12 @@ static struct { |
96 | 97 | { "message.terminalName", "Terminal name:" }, |
97 | 98 | { "message.tn3270eNoOpts", "No TN3270E options" }, |
98 | 99 | { "message.tn3270eOpts", "TN3270E options:" }, |
99 | -#if defined(_WIN32) /*[*/ | |
100 | +#if defined(_WIN32) | |
100 | 101 | { "message.windowsCodePage", "Windows code page:" }, |
101 | -#endif /*][*/ | |
102 | +#endif | |
102 | 103 | { NULL, NULL } |
103 | 104 | }; |
104 | -#endif /*]*/ | |
105 | +#endif | |
105 | 106 | |
106 | 107 | static struct dresource { |
107 | 108 | struct dresource *next; |
... | ... | @@ -127,7 +128,6 @@ void add_resource(const char *name, const char *value) |
127 | 128 | drdb_next = &d->next; |
128 | 129 | } |
129 | 130 | |
130 | - | |
131 | 131 | const char * get_resource(H3270 *hSession, const char *name) |
132 | 132 | { |
133 | 133 | struct dresource *d; |
... | ... | @@ -165,7 +165,7 @@ const char * get_resource(H3270 *hSession, const char *name) |
165 | 165 | return NULL; |
166 | 166 | } |
167 | 167 | |
168 | -/* A version of get_resource that accepts sprintf arguments. */ | |
168 | +/// @brief A version of get_resource that accepts sprintf arguments. | |
169 | 169 | const char * get_fresource(H3270 *hSession, const char *fmt, ...) |
170 | 170 | { |
171 | 171 | va_list args; |
... | ... | @@ -180,3 +180,5 @@ const char * get_fresource(H3270 *hSession, const char *fmt, ...) |
180 | 180 | return r; |
181 | 181 | } |
182 | 182 | |
183 | +*/ | |
184 | + | ... | ... |
src/core/util.c
... | ... | @@ -138,18 +138,18 @@ xs_error(const char *fmt, ...) |
138 | 138 | lib3270_free(r); |
139 | 139 | } |
140 | 140 | |
141 | - | |
142 | -/** | |
143 | - * @brief Definition resource splitter. | |
144 | - * | |
145 | - * Definition resource splitter, for resources of the repeating form: | |
146 | - * left: right\n | |
147 | - * | |
148 | - * Can be called iteratively to parse a list. | |
149 | - * Returns 1 for success, 0 for EOF, -1 for error. | |
150 | - * | |
151 | - * Note: Modifies the input string. | |
152 | - */ | |
141 | +/* | |
142 | +/// | |
143 | +/// @brief Definition resource splitter. | |
144 | +/// | |
145 | +/// Definition resource splitter, for resources of the repeating form: | |
146 | +/// left: right\n | |
147 | +/// | |
148 | +/// Can be called iteratively to parse a list. | |
149 | +/// Returns 1 for success, 0 for EOF, -1 for error. | |
150 | +/// | |
151 | +/// Note: Modifies the input string. | |
152 | +/// | |
153 | 153 | int |
154 | 154 | split_dresource(char **st, char **left, char **right) |
155 | 155 | { |
... | ... | @@ -157,19 +157,19 @@ split_dresource(char **st, char **left, char **right) |
157 | 157 | char *t; |
158 | 158 | Boolean quote; |
159 | 159 | |
160 | - /* Skip leading white space. */ | |
160 | + // Skip leading white space. | |
161 | 161 | while (my_isspace(*s)) |
162 | 162 | s++; |
163 | 163 | |
164 | - /* If nothing left, EOF. */ | |
164 | + // If nothing left, EOF. | |
165 | 165 | if (!*s) |
166 | 166 | return 0; |
167 | 167 | |
168 | - /* There must be a left-hand side. */ | |
168 | + // There must be a left-hand side. | |
169 | 169 | if (*s == ':') |
170 | 170 | return -1; |
171 | 171 | |
172 | - /* Scan until an unquoted colon is found. */ | |
172 | + // Scan until an unquoted colon is found. | |
173 | 173 | *left = s; |
174 | 174 | for (; *s && *s != ':' && *s != '\n'; s++) |
175 | 175 | if (*s == '\\' && *(s+1) == ':') |
... | ... | @@ -177,34 +177,34 @@ split_dresource(char **st, char **left, char **right) |
177 | 177 | if (*s != ':') |
178 | 178 | return -1; |
179 | 179 | |
180 | - /* Stip white space before the colon. */ | |
180 | + // Stip white space before the colon. | |
181 | 181 | for (t = s-1; my_isspace(*t); t--) |
182 | 182 | *t = '\0'; |
183 | 183 | |
184 | - /* Terminate the left-hand side. */ | |
184 | + // Terminate the left-hand side. | |
185 | 185 | *(s++) = '\0'; |
186 | 186 | |
187 | - /* Skip white space after the colon. */ | |
187 | + // Skip white space after the colon. | |
188 | 188 | while (*s != '\n' && my_isspace(*s)) |
189 | 189 | s++; |
190 | 190 | |
191 | - /* There must be a right-hand side. */ | |
191 | + // There must be a right-hand side. | |
192 | 192 | if (!*s || *s == '\n') |
193 | 193 | return -1; |
194 | 194 | |
195 | - /* Scan until an unquoted newline is found. */ | |
195 | + // Scan until an unquoted newline is found. | |
196 | 196 | *right = s; |
197 | 197 | quote = False; |
198 | 198 | for (; *s; s++) { |
199 | 199 | if (*s == '\\' && *(s+1) == '"') |
200 | 200 | s++; |
201 | - else if (*s == '"') | |
201 | + else if (*s == '"')split_dresource | |
202 | 202 | quote = !quote; |
203 | 203 | else if (!quote && *s == '\n') |
204 | 204 | break; |
205 | 205 | } |
206 | 206 | |
207 | - /* Strip white space before the newline. */ | |
207 | + // Strip white space before the newline. | |
208 | 208 | if (*s) { |
209 | 209 | t = s; |
210 | 210 | *st = s+1; |
... | ... | @@ -215,27 +215,29 @@ split_dresource(char **st, char **left, char **right) |
215 | 215 | while (my_isspace(*t)) |
216 | 216 | *t-- = '\0'; |
217 | 217 | |
218 | - /* Done. */ | |
218 | + // Done. | |
219 | 219 | return 1; |
220 | 220 | } |
221 | +*/ | |
221 | 222 | |
222 | -/** | |
223 | - * @brief Split a DBCS resource into its parts. | |
224 | - * | |
225 | - * Returns the number of parts found: | |
226 | - * -1 error (empty sub-field) | |
227 | - * 0 nothing found | |
228 | - * 1 one and just one thing found | |
229 | - * 2 two things found | |
230 | - * 3 more than two things found | |
231 | - */ | |
223 | +/* | |
224 | +/// | |
225 | +/// @brief Split a DBCS resource into its parts. | |
226 | +/// | |
227 | +/// Returns the number of parts found: | |
228 | +/// -1 error (empty sub-field) | |
229 | +/// 0 nothing found | |
230 | +/// 1 one and just one thing found | |
231 | +/// 2 two things found | |
232 | +/// 3 more than two things found | |
233 | +/// | |
232 | 234 | int |
233 | 235 | split_dbcs_resource(const char *value, char sep, char **part1, char **part2) |
234 | 236 | { |
235 | 237 | int n_parts = 0; |
236 | 238 | const char *s = value; |
237 | - const char *f_start = CN; /* start of sub-field */ | |
238 | - const char *f_end = CN; /* end of sub-field */ | |
239 | + const char *f_start = CN; // start of sub-field | |
240 | + const char *f_end = CN; // end of sub-field | |
239 | 241 | char c; |
240 | 242 | char **rp; |
241 | 243 | |
... | ... | @@ -292,14 +294,16 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2) |
292 | 294 | s++; |
293 | 295 | } |
294 | 296 | } |
297 | +*/ | |
295 | 298 | |
296 | -#if defined(X3270_DISPLAY) /*[*/ | |
297 | -/** | |
298 | - * @brief List resource splitter, for lists of elements speparated by newlines. | |
299 | - * | |
300 | - * Can be called iteratively. | |
301 | - * Returns 1 for success, 0 for EOF, -1 for error. | |
302 | - */ | |
299 | +/* | |
300 | +#if defined(X3270_DISPLAY) | |
301 | +/// | |
302 | +/// @brief List resource splitter, for lists of elements speparated by newlines. | |
303 | +/// | |
304 | +/// Can be called iteratively. | |
305 | +/// Returns 1 for success, 0 for EOF, -1 for error. | |
306 | +/// | |
303 | 307 | int |
304 | 308 | split_lresource(char **st, char **value) |
305 | 309 | { |
... | ... | @@ -307,18 +311,18 @@ split_lresource(char **st, char **value) |
307 | 311 | char *t; |
308 | 312 | Boolean quote; |
309 | 313 | |
310 | - /* Skip leading white space. */ | |
314 | + // Skip leading white space. | |
311 | 315 | while (my_isspace(*s)) |
312 | 316 | s++; |
313 | 317 | |
314 | - /* If nothing left, EOF. */ | |
318 | + // If nothing left, EOF. | |
315 | 319 | if (!*s) |
316 | 320 | return 0; |
317 | 321 | |
318 | - /* Save starting point. */ | |
322 | + // Save starting point. | |
319 | 323 | *value = s; |
320 | 324 | |
321 | - /* Scan until an unquoted newline is found. */ | |
325 | + // Scan until an unquoted newline is found. | |
322 | 326 | quote = False; |
323 | 327 | for (; *s; s++) { |
324 | 328 | if (*s == '\\' && *(s+1) == '"') |
... | ... | @@ -329,7 +333,7 @@ split_lresource(char **st, char **value) |
329 | 333 | break; |
330 | 334 | } |
331 | 335 | |
332 | - /* Strip white space before the newline. */ | |
336 | + // Strip white space before the newline. | |
333 | 337 | if (*s) { |
334 | 338 | t = s; |
335 | 339 | *st = s+1; |
... | ... | @@ -340,10 +344,11 @@ split_lresource(char **st, char **value) |
340 | 344 | while (my_isspace(*t)) |
341 | 345 | *t-- = '\0'; |
342 | 346 | |
343 | - /* Done. */ | |
347 | + // Done. | |
344 | 348 | return 1; |
345 | 349 | } |
346 | -#endif /*]*/ | |
350 | +#endif | |
351 | +*/ | |
347 | 352 | |
348 | 353 | |
349 | 354 | /** |
... | ... | @@ -375,9 +380,8 @@ ctl_see(int c) |
375 | 380 | return buf; |
376 | 381 | } |
377 | 382 | |
378 | -/** | |
379 | - * @brief Whitespace stripper. | |
380 | - */ | |
383 | +/* | |
384 | +/// @brief Whitespace stripper. | |
381 | 385 | char * |
382 | 386 | strip_whitespace(const char *s) |
383 | 387 | { |
... | ... | @@ -394,10 +398,12 @@ strip_whitespace(const char *s) |
394 | 398 | } |
395 | 399 | return t; |
396 | 400 | } |
401 | +*/ | |
397 | 402 | |
398 | -/** | |
399 | - * @brief Hierarchy (a>b>c) splitter. | |
400 | - */ | |
403 | +/* | |
404 | +/// | |
405 | +/// @brief Hierarchy (a>b>c) splitter. | |
406 | +/// | |
401 | 407 | Boolean |
402 | 408 | split_hier(char *label, char **base, char ***parents) |
403 | 409 | { |
... | ... | @@ -429,14 +435,14 @@ split_hier(char *label, char **base, char ***parents) |
429 | 435 | } |
430 | 436 | return True; |
431 | 437 | } |
438 | +*/ | |
432 | 439 | |
433 | -/** | |
434 | - * @brief Incremental, reallocing version of snprintf. | |
435 | - */ | |
440 | +/* | |
441 | +/// @brief Incremental, reallocing version of snprintf. | |
436 | 442 | #define RPF_BLKSIZE 4096 |
437 | 443 | #define SP_TMP_LEN 16384 |
438 | 444 | |
439 | -/* Initialize an RPF structure. */ | |
445 | +/// @brief Initialize an RPF structure. | |
440 | 446 | void |
441 | 447 | rpf_init(rpf_t *r) |
442 | 448 | { |
... | ... | @@ -445,18 +451,14 @@ rpf_init(rpf_t *r) |
445 | 451 | r->cur_len = 0; |
446 | 452 | } |
447 | 453 | |
448 | -/** | |
449 | - * @brief Reset an initialized RPF structure (re-use with length 0). | |
450 | - */ | |
454 | +/// @brief Reset an initialized RPF structure (re-use with length 0). | |
451 | 455 | void |
452 | 456 | rpf_reset(rpf_t *r) |
453 | 457 | { |
454 | 458 | r->cur_len = 0; |
455 | 459 | } |
456 | 460 | |
457 | -/** | |
458 | - * @brief Append a string to a dynamically-allocated buffer. | |
459 | - */ | |
461 | +/// @brief Append a string to a dynamically-allocated buffer. | |
460 | 462 | void |
461 | 463 | rpf(rpf_t *r, char *fmt, ...) |
462 | 464 | { |
... | ... | @@ -465,14 +467,14 @@ rpf(rpf_t *r, char *fmt, ...) |
465 | 467 | int ns; |
466 | 468 | char tbuf[SP_TMP_LEN]; |
467 | 469 | |
468 | - /* Figure out how much space would be needed. */ | |
470 | + // Figure out how much space would be needed. | |
469 | 471 | va_start(a, fmt); |
470 | - ns = vsprintf(tbuf, fmt, a); /* XXX: dangerous, but so is vsnprintf */ | |
472 | + ns = vsprintf(tbuf, fmt, a); // XXX: dangerous, but so is vsnprintf | |
471 | 473 | va_end(a); |
472 | 474 | if (ns >= SP_TMP_LEN) |
473 | 475 | Error(NULL,"rpf overrun"); |
474 | 476 | |
475 | - /* Make sure we have that. */ | |
477 | + // Make sure we have that. | |
476 | 478 | while (r->alloc_len - r->cur_len < ns + 1) { |
477 | 479 | r->alloc_len += RPF_BLKSIZE; |
478 | 480 | need_realloc = True; |
... | ... | @@ -481,22 +483,20 @@ rpf(rpf_t *r, char *fmt, ...) |
481 | 483 | r->buf = Realloc(r->buf, r->alloc_len); |
482 | 484 | } |
483 | 485 | |
484 | - /* Scribble onto the end of that. */ | |
486 | + // Scribble onto the end of that. | |
485 | 487 | (void) strcpy(r->buf + r->cur_len, tbuf); |
486 | 488 | r->cur_len += ns; |
487 | 489 | } |
488 | 490 | |
489 | -/** | |
490 | - * @brief Free resources associated with an RPF. | |
491 | - */ | |
492 | -void | |
493 | -rpf_free(rpf_t *r) | |
491 | +/// @brief Free resources associated with an RPF. | |
492 | +void rpf_free(rpf_t *r) | |
494 | 493 | { |
495 | 494 | lib3270_free(r->buf); |
496 | 495 | r->buf = NULL; |
497 | 496 | r->alloc_len = 0; |
498 | 497 | r->cur_len = 0; |
499 | 498 | } |
499 | +*/ | |
500 | 500 | |
501 | 501 | LIB3270_EXPORT void * lib3270_free(void *p) |
502 | 502 | { | ... | ... |
src/include/utilc.h
... | ... | @@ -13,24 +13,22 @@ |
13 | 13 | * for more details. |
14 | 14 | */ |
15 | 15 | |
16 | -/* | |
17 | - * utilc.h | |
18 | - * Global declarations for util.c. | |
16 | +/*** | |
17 | + * @brief Global declarations for util.c. | |
19 | 18 | */ |
20 | 19 | |
21 | -LIB3270_INTERNAL void add_resource(const char *name, const char *value); | |
22 | 20 | LIB3270_INTERNAL char *ctl_see(int c); |
23 | -// LIB3270_INTERNAL char *do_subst(const char *s, Boolean do_vars, Boolean do_tilde); | |
24 | -// LIB3270_INTERNAL void fcatv(FILE *f, char *s); | |
21 | + | |
22 | + /* | |
23 | +LIB3270_INTERNAL void add_resource(const char *name, const char *value); | |
25 | 24 | LIB3270_INTERNAL const char *get_message(const char *key); |
26 | 25 | LIB3270_INTERNAL const char *get_fresource(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3); |
27 | 26 | LIB3270_INTERNAL const char *get_resource(H3270 *hSession, const char *name); |
28 | -// LIB3270_INTERNAL char *scatv(const char *s, char *buf, size_t len); | |
29 | -LIB3270_INTERNAL int split_dbcs_resource(const char *value, char sep, char **part1, | |
30 | - char **part2); | |
27 | +LIB3270_INTERNAL int split_dbcs_resource(const char *value, char sep, char **part1, char **part2); | |
31 | 28 | LIB3270_INTERNAL int split_dresource(char **st, char **left, char **right); |
32 | 29 | LIB3270_INTERNAL int split_lresource(char **st, char **value); |
33 | 30 | LIB3270_INTERNAL char *strip_whitespace(const char *s); |
31 | +*/ | |
34 | 32 | |
35 | 33 | LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) LIB3270_GNUC_FORMAT(1, 2); |
36 | 34 | LIB3270_INTERNAL void xs_error(const char *fmt, ...) LIB3270_GNUC_FORMAT(1, 2); |
... | ... | @@ -44,11 +42,12 @@ LIB3270_INTERNAL void RemoveSource(H3270 *session, void *cookie); |
44 | 42 | LIB3270_INTERNAL void * AddTimer(unsigned long msec, H3270 *session, int (*fn)(H3270 *session)); |
45 | 43 | LIB3270_INTERNAL void RemoveTimer(H3270 *session, void *cookie); |
46 | 44 | |
47 | -LIB3270_INTERNAL const char * KeysymToString(KeySym k); | |
45 | +// LIB3270_INTERNAL const char * KeysymToString(KeySym k); | |
48 | 46 | |
49 | 47 | // LIB3270_INTERNAL int read_resource_file(const char *filename, Boolean fatal); |
50 | -LIB3270_INTERNAL Boolean split_hier(char *label, char **base, char ***parents); | |
48 | +// LIB3270_INTERNAL Boolean split_hier(char *label, char **base, char ***parents); | |
51 | 49 | |
50 | +/* | |
52 | 51 | typedef struct { |
53 | 52 | char *buf; |
54 | 53 | int alloc_len; |
... | ... | @@ -59,6 +58,7 @@ LIB3270_INTERNAL void rpf_init(rpf_t *r); |
59 | 58 | LIB3270_INTERNAL void rpf_reset(rpf_t *r); |
60 | 59 | LIB3270_INTERNAL void rpf(rpf_t *r, char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3); |
61 | 60 | LIB3270_INTERNAL void rpf_free(rpf_t *r); |
61 | +*/ | |
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @brief "unescape" text (Replaces %value for corresponding character). | ... | ... |