Mercurial > gftp.yaz
comparison lib/cache.c @ 516:fbb5a02beddb
2004-7-26 Brian Masney <masneyb@gftp.org>
* lib/config_file.c lib/local.c lib/ftps.c lib/gftp.h lib/httpcommon.h
lib/https.c lib/misc.c lib/protocols.c lib/pty.c lib/rfc2068.c
lib/rfc959.c lib/sshv2.c - various fixes found through a static code
analysis checker. (some signed/unsigned fixes, removed unneeded casts,
removed unneeded variables, more consistency, largefile fixes). Thanks
to Derek M Jones for running the static code analysis for me
* lib/cache.c - s/remove/del_entry/g
* lib/bookmark.c lib/protocols.c (gftp_parse_bookmark) - allow
the third parameter of this function to be a NULL pointer
| author | masneyb |
|---|---|
| date | Tue, 27 Jul 2004 02:46:54 +0000 |
| parents | 075f89b4395c |
| children | 7f54d0c0edbc |
comparison
equal
deleted
inserted
replaced
| 515:cb78cf311d23 | 516:fbb5a02beddb |
|---|---|
| 294 void | 294 void |
| 295 gftp_delete_cache_entry (gftp_request * request, char *descr, | 295 gftp_delete_cache_entry (gftp_request * request, char *descr, |
| 296 int ignore_directory) | 296 int ignore_directory) |
| 297 { | 297 { |
| 298 char *oldindexfile, *newindexfile, buf[BUFSIZ], description[BUFSIZ]; | 298 char *oldindexfile, *newindexfile, buf[BUFSIZ], description[BUFSIZ]; |
| 299 int indexfd, newfd, del_entry; | |
| 299 gftp_getline_buffer * rbuf; | 300 gftp_getline_buffer * rbuf; |
| 300 gftp_cache_entry centry; | 301 gftp_cache_entry centry; |
| 301 int indexfd, newfd; | |
| 302 size_t len; | 302 size_t len; |
| 303 time_t now; | 303 time_t now; |
| 304 int remove; | |
| 305 | 304 |
| 306 g_return_if_fail (request != NULL || descr != NULL); | 305 g_return_if_fail (request != NULL || descr != NULL); |
| 307 | 306 |
| 308 time (&now); | 307 time (&now); |
| 309 if (request != NULL) | 308 if (request != NULL) |
| 339 while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf) - 1, indexfd) > 0) | 338 while (gftp_get_line (NULL, &rbuf, buf, sizeof (buf) - 1, indexfd) > 0) |
| 340 { | 339 { |
| 341 if (gftp_parse_cache_line (request, ¢ry, buf) < 0) | 340 if (gftp_parse_cache_line (request, ¢ry, buf) < 0) |
| 342 continue; | 341 continue; |
| 343 | 342 |
| 344 remove = 0; | 343 del_entry = 0; |
| 345 if (centry.expiration_date < now) | 344 if (centry.expiration_date < now) |
| 346 remove = 1; | 345 del_entry = 1; |
| 347 else if (ignore_directory) | 346 else if (ignore_directory) |
| 348 { | 347 { |
| 349 if (strncmp (centry.url, description, strlen (description)) == 0) | 348 if (strncmp (centry.url, description, strlen (description)) == 0) |
| 350 remove = 1; | 349 del_entry = 1; |
| 351 } | 350 } |
| 352 else | 351 else |
| 353 { | 352 { |
| 354 if (strcmp (centry.url, description) == 0) | 353 if (strcmp (centry.url, description) == 0) |
| 355 remove = 1; | 354 del_entry = 1; |
| 356 } | 355 } |
| 357 | 356 |
| 358 | 357 |
| 359 if (remove) | 358 if (del_entry) |
| 360 unlink (centry.file); | 359 unlink (centry.file); |
| 361 else | 360 else |
| 362 { | 361 { |
| 363 /* Make sure we put the tabs back in the line. I do it this way | 362 /* Make sure we put the tabs back in the line. I do it this way |
| 364 so that I don't have to allocate memory again for each line | 363 so that I don't have to allocate memory again for each line |
