Commit graph

32 commits

Author SHA1 Message Date
George Peter Banyard
ef287bfceb
Minor refactoring of std string extension (#8196)
Mainly using more appropriate types, early returns, and moving the happy path to the primary scope (failure path is guarded by ``UNEXPECTED`` macros.
2022-04-23 12:15:13 +01:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Dmitry Stogov
d02734f05e Loop invariant code motion 2021-03-04 02:10:10 +03:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
Peter Kokot
f63829852e [ci skip] Remove text editor modelines
These were already removed 92ac598aab
and this fixes some leftovers. These files don't really need these
settings.
2019-03-23 21:09:38 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Peter Kokot
37c329d715 Trim trailing whitespace in source code files 2018-10-13 14:17:28 +02:00
Peter Kokot
77118fc925 Remove HAVE_ASSERT_H
The `<assert.h>` header file is part of the standard C89 headers [1] and
on older systems there needed to be also a manual check if header is
present.

Since PHP requires at least C89 manual check and the `HAVE_ASSERT_H`
symbol defined by Autoconf in configure.ac can be both removed [2].

This patch also removes unused <assert.h> includes where c files don't
use the `assert()` macro.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
2018-09-09 09:43:03 +02:00
Zenju
69a49af0d3 Fix out-of bounds access
Test case: strnatcmp_ex(L"333", 3, L"333 ", 4, true)
The reason this bug didn't come up earlier is probably because most input strings are null-terminated.
2018-07-06 19:02:19 +02:00
Nikita Popov
e0e5063173 Drop some pieces of commented-out code 2016-09-04 12:56:06 +02:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Andrea Faulds
2cca4d0193 Fix undefined behaviour in strnatcmp 2014-12-13 22:06:27 +00:00
Anatol Belski
172ca172d1 correct fix to the natcmp_ex
Till now the actualy length diff between the strings was under
circumstances returned. Whereby for a compare function only return
values of (1, 0, -1) make sense. Thus the old behavior isn't
present anymore, natcmp_ex now behaves as a standard compare function.
2014-09-15 12:58:46 +02:00
Anatol Belski
29f8b21cd7 fix int overflow preserving the old behavior 2014-09-14 16:39:25 +02:00
Rasmus Lerdorf
b3de24c9b8 Fix for bug #49698 2009-09-28 13:29:53 +00:00
Rasmus Lerdorf
124a0a5a69 Restore intra-string whitespace collapsing broken in the previous change. 2009-08-08 14:39:34 +00:00
Rasmus Lerdorf
2ee8b65e4e Oops, true/false are not defined on Linux. They are on OSX. 2009-08-07 17:32:31 +00:00
Rasmus Lerdorf
934a9037c8 Only skip leading 0's - fixes a test I broke a while ago 2009-08-07 17:14:19 +00:00
Rasmus Lerdorf
7bba051009 Fix bug #49003 by tweaking the fix to bug #44929 slightly.
A 0 followed by any punctuation is now significant instead
of just 0's in front of a period.
2009-07-21 21:15:48 +00:00
Jani Taskinen
785f1bd170 - Fixed bug #47481 (natcasesort() does not sort extended ASCII characters correctly) 2009-07-17 11:13:51 +00:00
Rasmus Lerdorf
cefbe2a8eb Don't strip a leading 0 in a floating point number 2009-04-09 15:55:46 +00:00
Rasmus Lerdorf
70c7e179de Fixed bug #44929 - Better handling of leading zeros 2009-04-08 18:10:46 +00:00
Ilia Alshanetsky
a75608c1de Fixed Bug #29075 (strnatcmp() incorrectly handles whitespace).
# Original Patch by: curt@php.net
2004-07-15 01:26:03 +00:00
Moriyoshi Koizumi
0ad2fc2007 Fixed bug #19795
# to*() and is*() expect for their arguments an integer in range of 0 - 255
2003-04-16 21:10:29 +00:00
Sascha Schumann
a6c3ce15ae don't emit code for version 2002-05-04 17:36:58 +00:00
Derick Rethans
78747bd2df - Don't wrap lines... this is annoying while coding. 2001-09-09 13:29:31 +00:00
Rasmus Lerdorf
81e2cf03ac Fix folding and clean up some extensions 2001-06-06 13:06:12 +00:00
Rasmus Lerdorf
25c3a3a39d vim-6 does folding - clean up a bunch of missing folding tags plus
some misguided RINIT and RSHUTDOWN calls in a few fringe extensions
2001-06-05 13:12:10 +00:00
Andrei Zmievski
9e9ba7d974 @ Updated natural comparison/sorting algorithm by Martin Pool
@ <mbp@humbug.org.au>. (Andrei)

Martin Pool updated the natural comparison/sort algorithm so that fractions
compare more "naturally", e.g. 1.002 < 1.1.
2000-04-29 18:57:06 +00:00
Zeev Suraski
aa6769dde2 - Make Windows builds build again
- Make non-gcc based platforms compile again
2000-04-13 16:08:49 +00:00
Thies C. Arntzen
9f598b187c the asset call caused an undefined __eprintf here! 2000-04-13 13:04:02 +00:00
Andrei Zmievski
c7100c4a1a Added natural comparison/sorting routines using code from Martin Pool.
@- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(),
@  natsort(), and natcasesort(). These are useful for comparing and sorting
@  strings that contain numbers. Based on the code from Martin Pool
@  <mbp@humbug.org.au>. See http://www.linuxcare.com.au/projects/natsort/
@  for more info on natural sorting. (Andrei)
2000-04-12 19:39:02 +00:00