From 11e7a3bdbb4b40ea4417518dac9eba7ad55748d3 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Mon, 14 Feb 2022 12:12:10 +0200

Subject: [PATCH 1/1] String: Added replaceRegExp() method


include/the_Foundation/string.h | 26 +++++++++++++++++

src/string.c | 50 +++++++++++++++++++++++++++++++--

2 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/include/the_Foundation/string.h b/include/the_Foundation/string.h

index e158fe2..a09cf1c 100644

--- a/include/the_Foundation/string.h

+++ b/include/the_Foundation/string.h

@@ -85,6 +85,10 @@ iDeclareType(StringList)

iDeclareType(StringComparison)

iDeclareType(MultibyteChar)

iDeclareType(Stream)

+#if defined (iHaveRegExp)

+#endif

struct Impl_StringComparison {

 int     (*cmp)      (const char *, const char *);

@@ -264,6 +268,28 @@ iString * trimmed_String (const iString *);

void replace_String (iString *, const char *src, const char *dst);

void normalize_String (iString ); / NFC */

+#if defined (iHaveRegExp)

+/**

+int replaceRegExp_String (iString *, const iRegExp *regexp,

+#endif

int toInt_String (const iString *);

float toFloat_String (const iString *);

double toDouble_String (const iString *);

diff --git a/src/string.c b/src/string.c

index fc7a377..7db513e 100644

--- a/src/string.c

+++ b/src/string.c

@@ -30,6 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "the_Foundation/range.h"

#include "the_Foundation/stdthreads.h"

+#if defined (iHaveRegExp)

+# include "the_Foundation/regexp.h"

+#endif

#include <stdlib.h>

#include <stdarg.h>

#include <strings.h>

@@ -374,6 +378,46 @@ void replace_String(iString *d, const char *src, const char *dst) {

 }

}

+#if defined (iHaveRegExp)

+int replaceRegExp_String(iString *d, const iRegExp *regexp, const char *replacement,

+}

+#endif

void normalize_String(iString *d) {

 size_t len = 0;

 uint8_t *nfc =

@@ -498,7 +542,7 @@ iString *urlEncode_String(const iString *d) {

}

iString *maybeUrlEncodeExclude_String(const iString *d, const char *excluded) {

 iString *encoded = new_String();

 /* Note: Any UTF-8 code points are encoded as multiple %NN sequences. */

 for (const char *i = constBegin_String(d), *end = constEnd_String(d); i != end; ++i) {

@@ -514,7 +558,7 @@ iString *maybeUrlEncodeExclude_String(const iString *d, const char *excluded) {

         appendCStrN_String(encoded, escaped, 3);

     }

 }

}

static int fromHex_(char ch) {

@@ -547,7 +591,7 @@ iString *maybeUrlDecodeExclude_String(const iString *d, const char *excluded) {

     }

     appendData_Block(&decoded->chars, i, 1);

 }

}

iString *urlDecodeExclude_String(const iString *d, const char *excluded) {

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/master/patch/11e7a3bdbb4b40ea4417518dac9eba7ad55748d3.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
30.493722 milliseconds
Gemini-to-HTML Time
2.223426 milliseconds

This content has been proxied by September (ba2dc).