1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Rename two functions.

This commit is contained in:
Giuseppe Scrivano 2010-07-09 12:24:51 +02:00
parent ec40efb27b
commit cf3c678c82
7 changed files with 32 additions and 18 deletions

View File

@ -1,3 +1,17 @@
2010-07-09 Giuseppe Scrivano <gscrivano@gnu.org>
* css-url.c (get_urls_css_file): Use `wget_read_file' instead of
`read_file'. Use `wget_read_file_free' instead of `read_file_free'.
* convert.c (convert_links): Likewise.
* html-url.c (get_urls_html, get_urls_file): Likewise.
* res.c (res_parse_from_file): Likewise.
* utils.h: Rename `read_file' to `wget_read_file'. Rename
`read_file_free' to `wget_read_file_free'.
* utils.c (wget_read_file): Renamed from `read_file'.
(wget_read_file_free): Renamed from `read_file_free'.
2010-07-05 Giuseppe Scrivano <gscrivano@gnu.org> 2010-07-05 Giuseppe Scrivano <gscrivano@gnu.org>
* gnutls.c (ssl_init): New local variables `ca_directory' and `dir'. * gnutls.c (ssl_init): New local variables `ca_directory' and `dir'.

View File

@ -228,7 +228,7 @@ convert_links (const char *file, struct urlpos *links)
} }
} }
fm = read_file (file); fm = wget_read_file (file);
if (!fm) if (!fm)
{ {
logprintf (LOG_NOTQUIET, _("Cannot convert links in %s: %s\n"), logprintf (LOG_NOTQUIET, _("Cannot convert links in %s: %s\n"),
@ -248,7 +248,7 @@ convert_links (const char *file, struct urlpos *links)
{ {
logprintf (LOG_NOTQUIET, _("Unable to delete %s: %s\n"), logprintf (LOG_NOTQUIET, _("Unable to delete %s: %s\n"),
quote (file), strerror (errno)); quote (file), strerror (errno));
read_file_free (fm); wget_read_file_free (fm);
return; return;
} }
/* Now open the file for writing. */ /* Now open the file for writing. */
@ -257,7 +257,7 @@ convert_links (const char *file, struct urlpos *links)
{ {
logprintf (LOG_NOTQUIET, _("Cannot convert links in %s: %s\n"), logprintf (LOG_NOTQUIET, _("Cannot convert links in %s: %s\n"),
file, strerror (errno)); file, strerror (errno));
read_file_free (fm); wget_read_file_free (fm);
return; return;
} }
@ -342,7 +342,7 @@ convert_links (const char *file, struct urlpos *links)
if (p - fm->content < fm->length) if (p - fm->content < fm->length)
fwrite (p, 1, fm->length - (p - fm->content), fp); fwrite (p, 1, fm->length - (p - fm->content), fp);
fclose (fp); fclose (fp);
read_file_free (fm); wget_read_file_free (fm);
logprintf (LOG_VERBOSE, "%d-%d\n", to_file_count, to_url_count); logprintf (LOG_VERBOSE, "%d-%d\n", to_file_count, to_url_count);
} }

View File

@ -252,7 +252,7 @@ get_urls_css_file (const char *file, const char *url)
struct map_context ctx; struct map_context ctx;
/* Load the file. */ /* Load the file. */
fm = read_file (file); fm = wget_read_file (file);
if (!fm) if (!fm)
{ {
logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno)); logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno));
@ -268,6 +268,6 @@ get_urls_css_file (const char *file, const char *url)
ctx.nofollow = 0; ctx.nofollow = 0;
get_urls_css (&ctx, 0, fm->length); get_urls_css (&ctx, 0, fm->length);
read_file_free (fm); wget_read_file_free (fm);
return ctx.head; return ctx.head;
} }

View File

@ -659,7 +659,7 @@ get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
int flags; int flags;
/* Load the file. */ /* Load the file. */
fm = read_file (file); fm = wget_read_file (file);
if (!fm) if (!fm)
{ {
logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno)); logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno));
@ -701,7 +701,7 @@ get_urls_html (const char *file, const char *url, bool *meta_disallow_follow,
*meta_disallow_follow = ctx.nofollow; *meta_disallow_follow = ctx.nofollow;
xfree_null (ctx.base); xfree_null (ctx.base);
read_file_free (fm); wget_read_file_free (fm);
return ctx.head; return ctx.head;
} }
@ -716,7 +716,7 @@ get_urls_file (const char *file)
const char *text, *text_end; const char *text, *text_end;
/* Load the file. */ /* Load the file. */
fm = read_file (file); fm = wget_read_file (file);
if (!fm) if (!fm)
{ {
logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno)); logprintf (LOG_NOTQUIET, "%s: %s\n", file, strerror (errno));
@ -786,7 +786,7 @@ get_urls_file (const char *file)
tail->next = entry; tail->next = entry;
tail = entry; tail = entry;
} }
read_file_free (fm); wget_read_file_free (fm);
return head; return head;
} }

View File

@ -385,7 +385,7 @@ struct robot_specs *
res_parse_from_file (const char *filename) res_parse_from_file (const char *filename)
{ {
struct robot_specs *specs; struct robot_specs *specs;
struct file_memory *fm = read_file (filename); struct file_memory *fm = wget_read_file (filename);
if (!fm) if (!fm)
{ {
logprintf (LOG_NOTQUIET, _("Cannot open %s: %s"), logprintf (LOG_NOTQUIET, _("Cannot open %s: %s"),
@ -393,7 +393,7 @@ res_parse_from_file (const char *filename)
return NULL; return NULL;
} }
specs = res_parse (fm->content, fm->length); specs = res_parse (fm->content, fm->length);
read_file_free (fm); wget_read_file_free (fm);
return specs; return specs;
} }

View File

@ -1149,18 +1149,18 @@ read_whole_line (FILE *fp)
zero-terminated, and you should *not* read or write beyond the [0, zero-terminated, and you should *not* read or write beyond the [0,
length) range of characters. length) range of characters.
After you are done with the file contents, call read_file_free to After you are done with the file contents, call wget_read_file_free to
release the memory. release the memory.
Depending on the operating system and the type of file that is Depending on the operating system and the type of file that is
being read, read_file() either mmap's the file into memory, or being read, wget_read_file() either mmap's the file into memory, or
reads the file into the core using read(). reads the file into the core using read().
If file is named "-", fileno(stdin) is used for reading instead. If file is named "-", fileno(stdin) is used for reading instead.
If you want to read from a real file named "-", use "./-" instead. */ If you want to read from a real file named "-", use "./-" instead. */
struct file_memory * struct file_memory *
read_file (const char *file) wget_read_file (const char *file)
{ {
int fd; int fd;
struct file_memory *fm; struct file_memory *fm;
@ -1270,7 +1270,7 @@ read_file (const char *file)
memory needed to hold the FM structure itself. */ memory needed to hold the FM structure itself. */
void void
read_file_free (struct file_memory *fm) wget_read_file_free (struct file_memory *fm)
{ {
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
if (fm->mmap_p) if (fm->mmap_p)

View File

@ -97,8 +97,8 @@ bool has_wildcards_p (const char *);
bool has_html_suffix_p (const char *); bool has_html_suffix_p (const char *);
char *read_whole_line (FILE *); char *read_whole_line (FILE *);
struct file_memory *read_file (const char *); struct file_memory *wget_read_file (const char *);
void read_file_free (struct file_memory *); void wget_read_file_free (struct file_memory *);
void free_vec (char **); void free_vec (char **);
char **merge_vecs (char **, char **); char **merge_vecs (char **, char **);