Commit Graph

42 Commits

Author SHA1 Message Date
188989e067 Update copyright year 2024-01-07 12:41:02 +01:00
15ba1db248 Update copyrights 2023-08-31 12:57:30 +02:00
17f7560326 * libwget/hashmap.c (wget_hashmap_clear): Fix memory leak 2022-10-15 19:41:12 +02:00
3dc7f71098 Update copyright year 2022-02-25 17:46:43 +01:00
22162f82b2 Update copyright year 2021-01-22 21:58:38 +01:00
9ee411b46c * libwget/hashmap.c (wget_hashmap_iterator_next): Fix segfault 2020-10-10 20:05:17 +02:00
59d9ecd9c0 * Update copyright year to 2020 2020-01-10 00:33:02 +01:00
1a2c623f03 * libwget/hashmap.c: Improve C99 compliancy 2019-09-18 17:10:47 +02:00
4b9edbad2d Update Copyright statements to be compatible with update-copyright module 2019-09-10 23:41:56 +02:00
500a370ac2 Rename wget_hashmap types
* include/wget/wget.h: Rename wget_hashmap types
* libwget/dns_cache.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/stringmap.c: Likewise
* libwget/tls_session.c: Likewise
* src/blacklist.c: Likewise
* src/host.c: Likewise
* src/wget.c: Likewise
2019-08-12 11:12:27 +02:00
12f1a03693 Changed G_GNUC_WGET prefix to WGET_GCC
* include/wget/wget.h: Changed G_GNUC_WGET prefix to WGET_GCC
* */*.[ch]: Likewise
2019-08-08 17:13:24 +02:00
a0059b0c31 Rename wget_hashmap_iterator_t -> wget_hashmap_iterator
* include/wget/wget.h: Rename wget_hashmap_iterator_t -> wget_hashmap_iterator
* libwget/hashmap.c: Likewise
2019-07-18 12:40:22 +02:00
80e56aca7d Rename wget_hashmap_t -> wget_hashmap
* include/wget/wget.h: Rename wget_hashmap_t -> wget_hashmap
* libwget/*.c: Likewise
* src/*.c: Likewise
2019-07-18 12:38:04 +02:00
6a3f1d53c0 Typedef hashmap functions not as pointer
* include/wget/wget.h: Remove '*' signature from function typedefs
* libwget/*.c: Amend casts
* src/*.c: Likewise
* unit-tests/stringmap_perf.c: Likewise
2019-07-17 12:11:09 +02:00
d6c9cbd801 Rename _wget_hashmap_iterator_st -> wget_hashmap_iterator_st
* include/wget/wget.h: Likewise
* libwget/hashmap.c: Likewise
2019-06-27 11:58:14 +02:00
4b61eff405 Rename _wget_hashmap_st -> wget_hashmap_st
* include/wget/wget.h: Likewise
* libwget/hashmap.c: Likewise
2019-06-27 11:57:01 +02:00
39d6f15873 Add memory checks and error return value to hashmap API
* include/wget/wget.h: wget_hashmap_sethashfunc() returns int
* libwget/hashmap.c: Check memory allocations
* libwget/stringmap.c: wget_stringmap_sethashfunc() returns int
2019-06-21 16:04:33 +02:00
d55c540b1b Simplify hashmap and stringmap API
* include/wget/wget.h: Replace _put() by _put_noalloc() functions to
  keep memory allocations outside the library functions.
* libwget/stringmap.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/*.c: Likewise
* src/*.c: Likewise
* unit-tests/*.c: Likewise
2019-06-21 16:04:29 +02:00
2c4f9439ce * libwget/hashmap.c (hashmap_rehash): Fix for wget_calloc() 2019-06-20 17:02:20 +02:00
802f2a65a5 Remove xcalloc define for wget_calloc
* libwget/private.h: Remove #define
* libwget/*.c: Replace xcalloc by wget_calloc
2019-06-20 16:50:58 +02:00
5079807ffd Remove xmalloc define for wget_malloc
* libwget/private.h: Remove #define
* libwget/*.c: Replace xmalloc by wget_malloc
2019-06-20 16:43:46 +02:00
e4c660ebc1 Fix hashmap + stringmap docs
* include/wget/wget.h: Add docs for hashmap/stringmap typedefs,
  fix argument of wget_hashmap_iterator_free()
* libwget/hashmap.c: Add docs, fix wget_hashmap_iterator_free()
* libwget/stringmap.c: Add docs
* unit-tests/test.c: Fix call to wget_stringmap_iterator_free()
2019-01-04 13:19:29 +01:00
7537c9fd86 Add iterators for hashmap and stringmap
* include/wget/wget.h: New functions wget_hashmap_iterator_alloc(),
  wget_hashmap_iterator_free(), wget_hashmap_iterator_next(),
  also for stringmap.
* libwget/hashmap.c: Implementation of the above functions
* libwget/stringmap.c: Add wget_stringmap_iterator_next()
* unit-tests/test.c: Add tests using stringmap iterator

This functionality is sometimes more handy than the *_browse() API
with callback functions and context variables.
2019-01-03 14:14:07 +01:00
744fa13072 Rename container set functions
* include/wget/wget.h:
  rename wget_vector_set_growth_policy() to wget_vector_set_resize_factor(),
  rename wget_hashmap_set_growth_policy() to wget_hashmap_set_resize_factor(),
  rename wget_hashmap_setloadfactor() to wget_hashmap_set_load_factor(),
  rename wget_stringmap_setloadfactor() to wget_stringmap_set_load_factor(),
  rename wget_stringmap_set_growth_policy() to wget_stringmap_set_resize_factor().
* libwget/hashmap.c: Likewise
* libwget/stringmap.c: Likewise
* libwget/vector.c: Likewise
2019-01-02 17:18:14 +01:00
1328e17609 Simplify hasmap/stringmap/vector API
* include/wget/wget.h: Remove wget_hashmap_get_null() and
  wget_stringmap_get_null(),
  change params and return value of wget_hashmap_get() and
  wget_stringmap_get().
* libwget/hashmap.c: Remove wget_hashmap_get_null(),
  change params and return value of wget_hashmap_get(),
  simplify hashmap_find_entry().
* libwget/stringmap.c: Remove wget_stringmap_get(),
  change params and return value of wget_stringmap_get().
* libwget/dns_cache.c: Amend for new API
* libwget/hpkp.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/tls_session.c: Likewise
* src/host.c: Likewise
* src/options.c: Likewise
* src/plugin.c: Likewise
* src/stats_site.c: Likewise
* unit-tests/test.c: Likewise
2019-01-02 16:35:11 +01:00
8a96e670ad Use float for container growth policy
* include/wget/wget.h: Use float for *_set_growth_policy()
* libwget/hashmap.c: Use float for wget_hashmap_set_growth_policy()
* libwget/stringmap.c: Use float for wget_stringmap_set_growth_policy()
* libwget/vector.c: Use float for wget_vector_set_growth_policy()

Additionally, the +/- logic has been reversed in the above functions.
2019-01-02 13:20:50 +01:00
cdb3600791 Update copyrigght to 2019 2019-01-02 12:42:53 +01:00
332b689925 Remove _GL_INLINE from functions
* libwget/hashmap.c: Likewise
* libwget/iri.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/utils.c: Likewise

Gcc 4.1.3 on NetBSD 5.1 errors when duplicate _GL_INLINE is given as a
function attribute.
From the gnulib manual: "C code ordinarily should not use inline. Typically it
is better to let the compiler figure out whether to inline, as compilers are
pretty good about optimization nowadays. In this sense, inline is like
register, another keyword that is typically no longer needed"
2018-04-30 20:07:49 +02:00
3ab8e40ffe Document hashmap and stringmap
* include/wget/wget.h: Cleanups
* libwget/hashmap.c: Documentation + cleanups
* libwget/stringmap.c: Documentation + cleanups
* libwget/vector.c: Fix doxygen issue
2018-03-27 16:46:00 +02:00
40cef71282 Reduce scope of variables
* libwget/bar.c: Likewise
* libwget/console.c: Likewise
* libwget/encoding.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/io.c: Likewise
* libwget/md5.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ssl_gnutls.c: Likewise
* libwget/xml.c: Likewise
* src/job.c: Likewise
* src/plugin.c: Likewise
* libwget/hashfile.c: Include local private.h
* src/host.c: Remove unused find_free_job_context struct

Found by: cppcheck
2017-10-05 00:27:31 +05:30
f073658ed3 Collect --stats-server for unique servers(IPs) only
* src/wget_stats.h: Add member 'scheme' to server_stats_t struct
* src/stats.c (stats_callback): Collect 'scheme' in server_stats_t struct
* src/stats.c (stats_print_*): Print 'scheme'
* include/wget/wget.h: Add WGET_STATS_SERVER_SCHEME to wget_server_stats_t enum
* libwget/hashmap.c (wget_hashmap_contains): Add check for 'h' being non-NULL
* libwget/http.c: Add _host_hash() as hash function for 'hosts' hashmap
* libwget/http.c: Add _host_compare() as compare function for 'hosts' hashmap
* libwget/http.c: Add _free_host_entry() destructor for 'hosts' hashmap
* libwget/http.c (host_add): Add host to 'hosts' hashmap
2017-09-19 10:40:34 +05:30
08ed5088f8 Remove rarely used parameter 'off' from wget_hashmap_create()
* libwget/hashmap.c: Remove 'off' parameter, now defaults to -2,
                     Add wget_hashmap_set_growth_policy() to set 'off'
* include/wget/wget.h: likewise
* libwget/hpkp.c: Adapt to the change in wget_hashmap_create()
* libwget/hsts.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/stringmap.c: Likewise
* libwget/test_linking.c: Likewise
* libwget/tls_session.c: Likewise
* src/blacklist.c: Likewise
* src/host.c: Likewise
* src/wget.c: Likewise
2017-06-11 16:13:14 +00:00
c6ee3d79ad Fix syntax-check 'sc_prohibit_have_config_h'
* cfg.mk: Remove sc_prohibit_have_config_h from local-checks-to-skip
* libwget/*.c: Include <config.h> unconditionally
* src/*.c: Likewise
* tests/*.c: Likewise
2017-04-30 22:01:34 +02:00
bc06128232 Fix space-tab sequences (syntax-check) 2017-04-29 20:40:14 +02:00
ec396c577f Fix URLs to HTTPS where possible 2017-02-28 15:31:30 +01:00
bfcd65c12b Use typedefs for function pointer arguments
* include/wget/wget.h: Add typedefs
* libwget/cookie.c: Use typedefs
* libwget/css.c: Likewise
* libwget/css_url.c: Likewise
* libwget/decompressor.c: Likewise
* libwget/hashmap.c: Likewise
* libwget/hsts.c: Likewise
* libwget/http.c: Likewise
* libwget/init.c: Likewise
* libwget/io.c: Likewise
* libwget/list.c: Likewise
* libwget/logger.c: Likewise
* libwget/metalink.c: Likewise
* libwget/net.c: Likewise
* libwget/netrc.c: Likewise
* libwget/ocsp.c: Likewise
* libwget/private.h: Likewise
* libwget/robots.c: Likewise
* libwget/stringmap.c: Likewise
* libwget/tls_session.c: Likewise
* libwget/vector.c: Likewise
* libwget/xml.c: Likewise
* src/blacklist.c: Likewise
* src/host.c: Likewise
* src/options.c: Likewise
* src/wget.c: Likewise
* tests/stringmap_perf.c: Likewise
* tests/test.c: Likewise
2017-01-23 14:43:17 +01:00
9568b0c87e Rename include/libwget.h to include/wget/wget.h+wgetver.h 2016-09-30 09:47:32 +02:00
21e050a614 Use xfree, xmalloc and xcalloc
* libwget/bar.c: Replace all calls to free(), malloc() and calloc() with
xfree(), xmalloc() and xcalloc() respectively
* libwget/hashmap.c: Same
2016-09-16 16:37:03 +02:00
dd3c2f63b2 Updated copyright year for all relevant files 2016-01-25 13:06:21 +01:00
f2c5bfa961 Add gnulib module inline
* autogen.sh: Add gnulib module inline
* configure.ac: Remove AC_C_INLINE
* libwget/hashmap.c: Replace inline by _GL_INLINE
* libwget/iri.c: Replace inline by _GL_INLINE
* libwget/ssl_gnutls.c: Replace inline by _GL_INLINE
* libwget/utils.c: Replace inline by _GL_INLINE
* libwget/xalloc.c: Replace inline by _GL_INLINE,
  include config.h
2016-01-12 17:35:39 +01:00
0f8e49128a Transfer copyright to Free Software Foundation, Inc. 2015-09-22 11:50:06 +02:00
c6b0e461a1 Transform Mget into Wget 2015-09-19 22:54:38 +02:00