summaryrefslogtreecommitdiff
path: root/lib/util/substitute.c
Commit message (Collapse)AuthorAgeFilesLines
* util:str_sub: talloc_free on errorDouglas Bagnall2021-03-111-0/+1
| | | | | Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Replace buggy string_sub_talloc() with talloc_string_sub() in lib/utilAndrew Bartlett2021-03-101-49/+117
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14658 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Mar 10 08:06:25 UTC 2021 on sn-devel-184
* util: Fix off-by-one error in message about overflowMartin Schwenke2019-07-051-8/+10
| | | | | | | | | | | | | | len includes space for the NUL character, so the calculation needs to take the NUL character into account. While touching this, drop unnecessary casts by updating format string and update to modern debug macro. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Jul 5 02:24:52 UTC 2019 on sn-devel-184
* util: Avoid localised underflowMartin Schwenke2019-07-051-6/+6
| | | | | | | | | | | | | | Avoid parenthesising an unsigned subtraction that can be negative and, therefore, underflow. There is no need for the parentheses and removing them results in an expression that is evaluated left-to-right and can not underflow. It isn't clear that the underflow matters. lp <= ls, so if (li - lp) underflows then ls + (li - lp) will always overflow. This should produce the correct answer. However, depending on this seems wrong. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* util: Fix signed/unsigned comparisons by declaring as size_tMartin Schwenke2019-07-011-8/+8
| | | | | | | | I may be missing something subtle but I can't see a reason for declaring these as ssize_t. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib:util: Add FALL_THROUGH statements in substitute.cAndreas Schneider2018-03-011-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* lib/util: Use charset_compat.h if SAMBA_UTIL_CORE_ONLYMartin Schwenke2014-10-041-0/+4
| | | | | | | | | | | | | | | | | When doing a CTDB standalone build we don't want to use dynconfig, since this introduces a lot of unwanted complexity. To avoid this, either: * charset needs to be nobbled to avoid loading the case tables, since this depends on dynconfig; or * charset needs to be avoid completely, so some functions need to be replaced with their ASCII counterparts. The 2nd options seems more honest and less error-prone. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Clean up includes for substitute.cMartin Schwenke2014-10-041-1/+4
| | | | | | | | Add substitute.h. Allows standalone compiles without external includes.h. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util: Replace an SMB_ASSERT()Martin Schwenke2014-10-041-1/+5
| | | | | | | Avoid a cyclic dependency. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util Re-merge the string_sub() and all_string_sub() from source3Andrew Bartlett2011-04-291-13/+42
| | | | Andrew Bartlett
* util_str: setup the correct talloc name for stringsStefan Metzmacher2009-01-191-0/+2
| | | | | metze (partly from samba4wins tree 447e7f9532131117e896712db9def321c96718eb)
* Move substitute functions to a different file.Jelmer Vernooij2008-10-181-0/+165