Commit Graph

45 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
ca851a9a27 * libwget/thread.c (wget_thread_self): Fix build issues with clang-16
With clang 16, specially on with musl libc, it would result in an
incompatible pointer to integer conversion error. As clang 16 has made a
few options default, including -Wincompatible-function-pointer-types.
This patch fixes that error.

First discovered on Gentoo's musl llvm profile. Please refer
https://bugs.gentoo.org/898058.

Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>

Copyright-paperwork-exempt: Yes
2023-05-29 18:45:56 +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
59d9ecd9c0 * Update copyright year to 2020 2020-01-10 00:33:02 +01:00
4b9edbad2d Update Copyright statements to be compatible with update-copyright module 2019-09-10 23:41:56 +02:00
21601c9078 Fix more docs [skip ci] 2019-08-17 23:00:50 +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
9cca7ac7e5 Rename wget_thread_cond_t -> wget_thread_cond
* include/wget/wget.h: Rename wget_thread_cond_t -> wget_thread_cond
* libwget/thread.c: Likewise
* src/wget.c: Likewise
* src/wget_job.h: Likewise
* unit-tests/test-cond.c: Likewise
2019-07-18 12:55:12 +02:00
aadf56562f Rename wget_thread_mutex_t -> wget_thread_mutex
* include/wget/wget.h: Rename wget_thread_mutex_t -> wget_thread_mutex
* libwget/*.c: Likewise
* src/*.c: Likewise
* unit-tests/test-cond.c: Likewise
2019-07-18 12:54:37 +02:00
19f58cbc68 Rename wget_thread_id_t -> wget_thread_id
* include/wget/wget.h: Rename wget_thread_id_t -> wget_thread_id
* libwget/thread.c: Likewise
* src/host.c: Likewise
* src/wget_job.h: Likewise
2019-07-18 12:52:24 +02:00
36bcc83b9a Rename wget_thread_t -> wget_thread
* include/wget/wget.h: Rename wget_thread_t -> wget_thread
* examples/batch_loader.c: Likewise
* libwget/thread.c: Likewise
* src/*.c: Likewise
* unit-tests/test-cond.c: Likewise
2019-07-18 12:50:41 +02:00
f31ad9eeee Rename _wget_thread_cond_st -> wget_thread_cond_st
* include/wget/wget.h: Likewise
* libwget/thread.c: Likewise
2019-06-27 12:01:47 +02:00
37853b0373 Rename _wget_thread_mutex_st -> wget_thread_mutex_st
* include/wget/wget.h: Likewise
* libwget/thread.c: Likewise
2019-06-27 12:01:10 +02:00
1031a9eebe Rename _wget_thread_st -> wget_thread_st
* include/wget/wget.h: Likewise
* libwget/thread.c: Likewise
2019-06-27 12:00:05 +02:00
138a03bf8a * libwget/thread.c: Manually inline wget_get_timemillis() into wget_thread_cond_wait() 2019-06-21 12:48:47 +02:00
66293d3dc5 * libwget/thread.c: Check result of malloc() 2019-06-20 16:34:48 +02:00
204bb692ef * libwget/thread.c: Remove #include timespec.h 2019-05-14 16:35:32 +02:00
cdb3600791 Update copyrigght to 2019 2019-01-02 12:42:53 +01:00
3688ffb941 Update copyright to 2018 2018-04-30 20:52:11 +02:00
2c7eb3a4d2 Fix doxygen syntax
* src/wget_gpgme.h: Likewise
* libwget/thread.c: Likewise
* src/wget_gpgme.h: Likewise
2018-03-02 10:32:53 +01:00
85d7f1fbff Revert "* libwget/thread.c(pthread_mutex_destroy): Survive destroying a non-initialized mutex"
This reverts commit c46669387b.
2018-02-15 17:05:36 +01:00
c46669387b * libwget/thread.c(pthread_mutex_destroy): Survive destroying a non-initialized mutex 2018-02-14 12:53:33 +01:00
fa679ee9ad Fix warnings
* configure.ac: Add -Wno-assign-enum -Wno-unreachable-code to gnulib warnings
* libwget/thread.c: Add #pragmas to silence warnings from gnulib includes
* libwget/utils.c: Likewise
* src/log.c: Likewise
* src/wget.c: Likewise
* src/bar.c: Make _terminate_thread static
* tests/test-gpg-styles.c: Make urls static
2018-01-11 15:16:01 +01:00
3ca0b66fbd Fix build to work without multi-threading
* libwget/thread.c: Fix wget_thread_start() and wget_thread_join()
* src/wget.c: Fix typo
* tests/libtest.c: Don't skip tests when multi-threading is disabled
2018-01-03 17:43:08 +01:00
734bf5e3dc * libwget/thread.c: Fix typos (make syntax-check) 2018-01-01 13:26:56 +01:00
d1847fb518 Add docs for thread functions
* docs/Makefile.am: Add man page
* libwget/thread.c: Add documentation
2017-12-31 18:47:19 +01:00
f2b61e9518 * libwget/thread.c: Suppress -Wundef warnings in gnulib includes 2017-12-28 14:12:26 +01:00
311e4a3bae Avoid copying initialized glthread structures
* libwget/thread.c: Use malloc+init instead init+memdup

Memdup'ing the glthread structures broke internal pointers,
at least on Windows.

Reported-by: Gisle Vanem
2017-12-27 23:52:46 +01:00
b82f692949 Thread abstraction via gnulib thread wrapper (glthread)
* bootstrap.conf: Add modules cond, lock and thread,
  remove module pthread
* include/wget/wget.h: Remove pthread code,
  add new wget_thread_* functions,
  amend params of wget_thread_* functions,
  add init and exit functions for mutex initialization
* */*.[ch]: Amend threading to new API

This change let libwget work with different kinds of
threading libraries incl. pthreads and windows threads.
2017-12-17 14:20:01 +01:00
7cfe73bf30 * libwget/thread.c: Do not call pthread functions with NULL thread value 2017-09-20 18:51:31 +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
ec396c577f Fix URLs to HTTPS where possible 2017-02-28 15:31:30 +01:00
582bc2890a * libwget/thread.c: Return a value in dummy wget_thread_cancel()
Reported-by: Gisle Vanem
2016-12-15 11:22:22 +01:00
8366ead860 * libwget/thread.c: Add missing wget_thread_cancel() dummy 2016-11-08 22:34:03 +01:00
9568b0c87e Rename include/libwget.h to include/wget/wget.h+wgetver.h 2016-09-30 09:47:32 +02:00
c6590e3433 Use pthread_cancel to kill a thread
* include/libwget.h.in: Export new function wget_thread_cancel to kill
an existing thread nicely.
* libwget/thread.c: Same
* src/bar.c: Use the cleaner wget_thread_cancel() method to kill the
progress bar instead of polling for a variable.
2016-09-16 16:37:03 +02:00
79dd277c12 Refactoring to separate send, receive and HTTP state machine
* examples/websequencediagram.c (main): Call wget_http_request_set_body()
  and wget_http_send_request() instead of wget_http_send_request_with_body().
* include/libwget.h.in: Add WGET_HTTP_USER_DATA, wget_get_timemillis(),
  extend wget_thread_cond_wait(), add body, user_data, body_length to
  wget_http_request_t, remove wget_http_send_request_with_body(),
  add wget_http_request_get_int(), wget_http_request_set_ptr(),
  wget_http_request_get_ptr(), wget_http_request_set_body().
* libwget/http.c: Add wget_http_request_get_int(),
  wget_http_request_set_ptr(), wget_http_request_get_ptr(),
  wget_http_request_set_body(),
  remove wget_http_send_request_with_body(),
  (wget_http_request_to_buffer): add body to request buffer.
* libwget/http_highlevel.c (wget_http_get): Replace
  wget_http_send_request_with_body()
* libwget/iri.c: Use c-ctype.h instead of ctype.h
  (wget_iri_parse): Allow any numbers of / after scheme:
  (wget_iri_parse): Catch URIs without /after scheme:
* libwget/list.c (wget_list_browse): Small code rearrangement
* libwget/metalink.c (_add_mirror): Check mirror.iri for NULL
* libwget/ssl_gnutls.c (send_ocsp_request): Replace
  wget_http_send_request_with_body()
* libwget/thread.c (wget_thread_cond_signal): Add timeout param
* libwget/utils.c: New function wget_get_timemillis()
* src/blacklist.c: Include wget.h instead of log.h
* src/blacklist.h: Fix indentation
* src/host.c: Add queueing stuff
* src/host.h: Reflect changes in host.c
* src/job.c: Remove queueing stuff
* src/job.h: Reflect changes in job.c
* src/log.c: Sync stdout/stderr to correct output order
* src/log.h: Remove shortcuts of print functions
* src/wget.c: Remove download_part() and http_get().
  Add http_send_request(), http_receive_response(), try_connection(),
  establish_connection(), add_statistics(), process_response_header().
  Amend downloader_thread() to reflect the changes.
* src/wget.h: Add shortcut defines for print functions.
* tests/libtest.c (_http_server_thread): Fix compiler warning,
  fix debug message.
  New function _write_msg() to print server messages yellow.
  (wget_test) Add -d to wget command line.
* tests/test-metalink.c (main): Add tests for V3 and V4 metalink
  files read from command line (-i, --force-metalink)
* tests/test.c (test_iri_parse): Add test for slash-less mailto: URI
2016-07-11 14:53:36 +02:00
f17bcd4a7d Cosmetics
* libwget/thread.c: Fix comment after #endif
* src/wget.c (main): Remove unwanted spaces in if clause
2016-02-03 10:21:56 +01:00
2c9f5945f5 Honor --disable-threads and support no threading
* include/libwget.h.in: Include <stdbool.h>.
Define wget_thread_support().
* libwget/thread.c: Change condition to check
for threading support.
(wget_thread_support): New function.
(wget_thread_start): [!USE_POSIX_THREADS && !USE_PTH_THREADS]
Invoke directly the function.
* src/wget.c (main): If no threads are supported then set the
number of max threads to 1.  If the queue is not empty, call again the
downloader function.  It will be used only in case no threads are
available.
(downloader_thread): Do not wait for new elements in the queue
when there are no threads.
* tests/libtest.c (wget_test_start_server): Skip the test if
there is no threads support.
2016-02-02 18:45:17 +01:00
dd3c2f63b2 Updated copyright year for all relevant files 2016-01-25 13:06:21 +01:00
17e8be5c68 Remove libpthread check from configure.ac
* configure.ac: Remove check for libpthread
* include/libwget.h.in: Check HAVE_PTHREAD_H,
  Do not undefine gettext
* libwget/thread.c: Check HAVE_PTHREAD_H

This check is done by gnulib 'pthread' module.
2016-01-22 14:33:49 +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