Commit Graph
255 Commits
Author SHA1 Message Date
Patrick Pelissier 16c6a13fb1 Make string functions exception aware 2024-04-22 23:41:23 +02:00
Patrick Pelissier ced2719760 Make string functions exception aware 2024-04-22 22:59:54 +02:00
Patrick Pelissier 1798530284 Fix issue in string_fgets
where it could be blocked infinity in the parsing
2024-04-22 22:51:59 +02:00
Patrick Pelissier 5805038943 Make string functions exception aware 2024-04-22 22:47:00 +02:00
Patrick Pelissier 2395ceb3d2 Remove obsolete and undocumented STRING_DECL_INIT macro 2024-04-20 00:42:38 +02:00
Patrick Pelissier 26cec1591a * Remove some obsolete macros
* Fix spelling
* A little bit of refactoring
2024-01-19 21:37:47 +01:00
Patrick Pelissier 52b58c5a51 Happy new year 2024 2024-01-19 21:37:47 +01:00
Patrick Pelissier 422f3c2c04 Add GENTYPE operator to all oplists 2023-12-30 16:23:02 +01:00
Patrick Pelissier 73e3d1d1bd Register string_t globally 2023-12-30 16:23:02 +01:00
Patrick Pelissier eaf2783f1a Synchro with master branch 2023-06-11 23:32:42 +02:00
Patrick Pelissier b50813713a Define internal M_INLINE:
it is used to control the inline semantics.
By combining it with optimize option "-fno-inline"
for the internal M*LIB function (using _Pragma optimize)
we can control easily if we want to use an inline version
or call of an external function.

Define new user API:
* M_USE_EXTERN_DECL : define it before including any MLIB header to requests to call the M*LIB functions and don't inline then.
* M_USE_EXTERN_DEF  : define it once in a translation unit to define the M*LIB functions. This translation unit shall contain all templated macro too.
If you use one option, you need to use the other one too for another translation unit.
2023-06-11 23:32:02 +02:00
Patrick Pelissier 2628536d20 Add +m_string_it_set_ref 2023-06-10 01:50:14 +02:00
Patrick Pelissier ecfa4a9152 Add new function string_pop_u
to pop the last unicode code point
of a string.
2023-06-03 00:59:34 +02:00
Patrick Pelissier aa18915d61 Fix overflow computation 2023-05-21 00:15:58 +02:00
Patrick Pelissier b487bfe5ad Adding missing inline 2023-05-08 23:54:16 +02:00
kitterion 05c5a94634 Add m_string_cat_vprintf 2023-05-08 20:52:47 +03:00
Patrick Pelissier 219c62ff5d Provide a way to alter the standard naming convention for the functions
Close #72
2023-04-22 09:33:08 +02:00
Patrick Pelissier 1d163a396e Replace assert by M_ASSERT 2023-04-03 00:12:00 +02:00
Patrick Pelissier 7534aa0d61 Add internal M_UNLIKELY_NOMEM to help coverage computation 2023-04-03 00:05:29 +02:00
Patrick Pelissier fbab093d52 Avoid warnings about variables never read. 2023-02-24 19:56:26 +01:00
Patrick Pelissier 925c06beb8 Fix usage of va_copy 2023-02-24 15:07:29 +01:00
Patrick Pelissier 482ec38e62 Fix wrong use of isprint function. 2023-02-11 14:34:13 +01:00
Patrick Pelissier a2ae209992 Happy new year 2023-01-02 12:57:41 +01:00
Patrick Pelissier f5bbc0a7fb Implement multiple kind of workarounds for GCC 12
as it produces more false warnings

Include missing header in C++ mode
2022-12-22 20:42:20 +01:00
Patrick Pelissier fb53a464d7 Update comments 2022-10-01 20:41:45 +02:00
Patrick Pelissier 95bc7063a0 Remove some warning with clang:
it complains about using a GNU extension
in GNU mode (gnu11)!
2022-10-01 11:36:14 +02:00
Patrick Pelissier 3aa3e95e4c Remove constraint of calling string_end_p
before string_next or string_get_cref
This generates slighty more code but it is much saner
from user point of view.
2022-09-13 00:18:15 +02:00
Patrick Pelissier d7b45cc220 Fix issue in string_previous 2022-09-11 23:14:52 +02:00
Patrick Pelissier cbb2b452bb Add string_previous function
to iterate on the previous UTF8 code point.
2022-09-10 16:30:45 +02:00
Patrick Pelissier 18f04da4ec Robustness/fix:
string_next won't advance if the end of string is reached.
2022-09-10 16:19:58 +02:00
Patrick Pelissier 41c4f5fe5c Add string functions :
* string_it_get_pos to return the position in the steam
* string_it_pos to start iterating from a given position.
2022-09-10 16:16:13 +02:00
Patrick Pelissier 2ab410bd6a Update comments to reflect that we work
on UTF8 code points and not Unicode characters.
2022-09-10 10:39:04 +02:00
Patrick Pelissier aefbc5b2f5 Factorize the test of the start of an UTF8 code point
in a separate function
2022-09-10 10:34:54 +02:00
Patrick Pelissier 442b0e7cea Reduce size of struct string_it_t on 64 bits
by storing an offset to the next character
instead of a pointer. An offset can be stored as a
BYTE instead of a PTR since UT-8 can use at most
4 characters per code point.
2022-09-10 09:59:06 +02:00
Patrick Pelissier abffe201e5 Change the suffix of the functions dealing with C-String to _cstr
instead of _str.
See #99 for details.
2022-07-30 12:00:55 +02:00
Patrick Pelissier 502756c731 Simplify the control flow to count for utf8 encoded characters 2022-06-16 23:58:23 +02:00
Patrick Pelissier c12d0a3f23 Update comments 2022-06-03 21:43:15 +02:00
Patrick Pelissier e93df4332a Fix issue for 16 bits architecture 2022-05-14 09:16:41 +02:00
Patrick Pelissier 2fb912d43d Should remove warning with Visual C++ 2022-04-23 10:34:54 +02:00
Patrick Pelissier 6d98c273c1 Add EMPLACE_TYPE from const char * 2022-04-21 23:11:11 +02:00
Patrick Pelissier daac0169d5 Reformat 2022-04-14 23:47:11 +02:00
Patrick Pelissier 4abf0ad2b2 Simplify code 2022-04-11 22:34:08 +02:00
Patrick Pelissier 50fd27e07b Use of M_DEFAULT_ARGS instead of M_IF_DEFAULT1 2022-04-10 23:09:29 +02:00
Patrick Pelissier 530cc8d2a2 Update comments 2022-03-31 22:16:10 +02:00
Patrick Pelissier a19e1acfff Add function m_string_set_si & m_string_set_ui for converting an integer into a string. 2022-03-26 16:08:28 +01:00
Patrick Pelissier a4d9b8df17 Moving internal types to internal namespace 2022-03-22 23:37:35 +01:00
Patrick Pelissier 9a1b4abcf9 Add missing small names 2022-03-15 19:29:18 +01:00
Patrick Pelissier a0fc57687b Fix format 2022-03-15 19:24:53 +01:00
Patrick Pelissier 02897f982f Add m_ prefix for the string API 2022-03-15 19:24:14 +01:00
Patrick Pelissier d7909f7312 Move internal function / macros with the m_string prefix to the internal m_str1ng prefix 2022-03-14 19:29:33 +01:00