summaryrefslogtreecommitdiff
path: root/src/estream-printf.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove Windows CE support.NIIBE Yutaka2022-06-281-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * contrib/*: Remove. * Makefile.am: Remove contrib. * autogen.sh: Remove Windows CE support. * configure.ac (have_w32ce_system): Remove. * src/Makefile.am [HAVE_W32CE_SYSTEM] (extra_cppflags): Remove. (gpg_extra_headers): Remove. (EXTRA_DIST): Remove mkw32errmap.c and w32ce-add.h (BUILT_SOURCES): Remove mkw32errmap.map.c. (tmp_files): Remove mkw32errmap.tab.h mkw32errmap.map.c (CLEANFILES): Likewise. * src/estream-printf.c [HAVE_W32CE_SYSTEM]: Remove. * src/estream.c [HAVE_W32CE_SYSTEM]: Remove. * src/gpg-error.def.in [HAVE_W32CE_SYSTEM]: Remove. * src/gpgrt-int.h: Fix comment. * src/init.c [HAVE_W32CE_SYSTEM]: Remove. * src/init.h [HAVE_W32CE_SYSTEM]: Remove. * src/mkheader.c: Remove Windows CE support. * src/mkw32errmap.c, src/w32ce-add.h: Remove. * src/spawn-posix.c [HAVE_W32CE_SYSTEM]: Remove. * src/spawn-w32.c [HAVE_W32CE_SYSTEM]: Remove. * src/sysutils.c [HAVE_W32CE_SYSTEM]: Remove. * src/w32-estream.c [HAVE_W32CE_SYSTEM]: Remove. * src/w32-reg.c [HAVE_W32CE_SYSTEM]: Remove. * tests/Makefile.am [HAVE_W32CE_SYSTEM]: Remove. -- GnuPG-bug-id: 5912 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* estream: Fix dead assigniment.Werner Koch2019-09-081-1/+0
| | | | | | | | * src/estream-printf.c (pr_string): Here. -- GnuPG-bug-id: 4698 Signed-off-by: Werner Koch <wk@gnupg.org>
* core: New functions gpgrt_abort and gpgrt_add_emergency_cleanup.Werner Koch2019-01-041-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/init.c (emergency_cleanup_list): New gloabl var. (_gpgrt_add_emergency_cleanup): New. (_gpgrt_abort): New. Repalce all calls to abort by this. Also replace all assert by either log_assert or a stderr output followed by a _gpgrt_abort. (run_emergency_cleanup): New. * src/visibility.c (gpgrt_add_emergency_cleanup): New public API. (gpgrt_abort): New public API. -- Libgcrypt uses its own assert function which makes sure to terminate the secure memory. This is safe as log as an assert is triggered internally in Libgcrypt. GnuPG runs emergency cleanup handlers right before log_fatal etc to tell Libgcrypt to terminate the secure memory. With the move of the logging function to gpgrt in gnupg 2.3 this did not anymore. Thus we now provide a mechanism in gpgrt to do right that. Eventually Libgcrypt can also make use of this. What this does not handle are calls to abort or failed asserts in external libraries or in libc. We can't do anything about it in a library because a library may not setup signal handlers. Signed-off-by: Werner Koch <wk@gnupg.org>
* estream: Use correct POSIX name THOUSEP.Werner Koch2018-12-121-5/+5
| | | | | | | | | | | * src/estream-printf.c: Replace HAVE_LANGINFO_THOUSANDS_SEP by HAVE_LANGINFO_THOUSEP. (pr_integer): Use THOUSEP. -- GnuPG-bug-id: 4286 Reported-by: miod Signed-off-by: Werner Koch <wk@gnupg.org>
* core: New functions gpgrt_fprintf_sf anf gpgrt_fprintf_sf_unlocked.Werner Koch2018-11-261-20/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (gpgrt_string_filter_t): New type. (gpgrt_fprintf_sf, gpgrt_fprintf_sf_unlocked): New. * src/gpg-error.vers, src/gpg-error.def.in: Add them. * src/visibility.c (gpgrt_fprintf_sf): New. (gpgrt_fprintf_sf_unlocked): New. * src/estream-printf.c (pr_string): Add and use args sf, sfvalue and string_no. (do_format): Add args sf and sfvalue. Keep a string format counter. (_gpgrt_estream_format): Add args sf and sfvalue. Change all callers to provide NULL for them. * src/estream.c (_gpgrt_vfprintf_unlocked, _gpgrt_vfprintf): Add sf and sfvalue and adjust all callers. (do_print_stream): Ditto. * tests/t-printf.c (stream_to_string): New. (struct sfstate_s): New. (string_filter): New. (check_fprintf_sf): New. (main): Call new test. -- The actual reason to implement these functions is to enhance the internal logging function with a filter to sanitized strings so that control values or other things can be quoted. Signed-off-by: Werner Koch <wk@gnupg.org>
* core: Initialize values in estream_formatAndre Heinecke2018-07-051-1/+5
| | | | | | | | | | | | | | * src/estream-printf.c (_gpgrt_estream_format): Make sure valuetable.value is inialized even on stack. -- This makes the behavior more consistent with the calloc'ed codepath for more then 8 variables. It also fixes a potential crash if there were unmatched format args provided. GnuPG-Bug-Id: T4054
* Fix more misspellings.Daniel Kahn Gillmor2016-11-181-1/+1
| | | | | | -- Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
* Convert http links to https where possible in the source.Daniel Kahn Gillmor2016-02-081-1/+1
| | | | | | | | | | | | | | | | -- * use https for bug reporting * in comments and docs, use https to refer to: - www.gnu.org - creativecommons.org - translationproject.org - mail.gnome.org - www.perl.org - www.ctan.org - www.cl.cam.ac.uk - www.ntg.nl - cygwin.com - www.ethnologue.com
* Add gpgrt_set_alloc_func.Werner Koch2014-08-261-1/+1
| | | | | | | | | | | | | * src/visibility.c (gpgrt_set_alloc_func): New. * configure.ac (_ESTREAM_PRINTF_REALLOC): Define. (_ESTREAM_PRINTF_EXTRA_INCLUDE): Define. * src/estream.c (mem_alloc, mem_realloc, mem_free): Simplify. (_gpgrt_free): Remove. * src/init.c (custom_realloc): New var. (_gpgrt_set_alloc_func): New. (_gpgrt_realloc, _gpgrt_malloc, _gpgrt_free): New. * src/visibility.h (gpg_err_deinit): Mark as visible.
* Finish inclusion of estream into the API.Werner Koch2014-08-251-0/+20
|
* First set of changes to include estream into the API.Werner Koch2014-08-251-21/+21
| | | | | | | | | | | * configure.ac (AH_BOTTOM): Define GPGRT_ENABLE_ES_MACROS. * src/gpg-error.h.in: include stdio.h. Include most of the estream functions and rename structures and types. * src/estream.h: Rewrite. Include only gpg-error.h and local prototypes. * src/estream.c: Rename types and macros. * src/estream-printf.c (_gpgrt_estream_snprintf): Prefix public functions with _gpgrt_.
* Add estream code from GnuPG.Werner Koch2014-08-251-0/+1855
* src/estream-printf.c, src/estream-printf.h: New. * src/estream.c, src/estream.h: New. * m4/estream.m4: New. * src/Makefile.am (libgpg_error_la_SOURCES): Add new files. * configure.ac (AH_BOTTOM): Define estream prefix. <gcc>: Add useful gcc warning options. (estream_INIT): Call. -- This is the base line patch to move the estream code from GnuPG to libgpg-error. The code has been taken from the GnuPG repository at commit cb680c5ea540738692a5c74951802b0fdc658e85. Signed-off-by: Werner Koch <wk@gnupg.org>