Fossil SCM

Do not use the memmem() C-library function as it is not available on Windows.

drh 2025-02-28 23:26 UTC trunk
Commit 7d28ae44fe56e99a8dc479831c3d0c4c7196d06ea9e984586ed471b53dcec7e2
1 file changed +1 -3
+1 -3
--- src/dispatch.c
+++ src/dispatch.c
@@ -1081,11 +1081,10 @@
10811081
const char *zTopic, /* TOPIC */
10821082
const char *zSubtopic /* SUBTOPIC */
10831083
){
10841084
Blob in, line, subsection;
10851085
int n = 0;
1086
- size_t nSub; /* Length of zSubtopic */
10871086
char *zQTop = re_quote(zTopic);
10881087
char *zQSub = re_quote(zSubtopic);
10891088
char *zPattern = mprintf("> fossil %s .*\\b%s\\b", zQTop, zQSub);
10901089
ReCompiled *pRe = 0;
10911090
@@ -1144,14 +1143,13 @@
11441143
11451144
/* If no subtopic name zSubtopic if found, try to match any text.
11461145
*/
11471146
blob_rewind(&in);
11481147
blob_init(&subsection, 0, 0);
1149
- nSub = (int)strlen(zSubtopic);
11501148
while( blob_line(&in, &line) ){
11511149
size_t len = blob_strlen(&line);
1152
- if( memmem(blob_buffer(&line), len, zSubtopic, nSub)!=0 ){
1150
+ if( strstr(blob_str(&line), zSubtopic)!=0 ){
11531151
if( blob_strlen(&subsection) && blob_buffer(&line)[0]!='>' ){
11541152
blob_appendb(pOut, &subsection);
11551153
blob_reset(&subsection);
11561154
}
11571155
blob_appendb(pOut, &line);
11581156
--- src/dispatch.c
+++ src/dispatch.c
@@ -1081,11 +1081,10 @@
1081 const char *zTopic, /* TOPIC */
1082 const char *zSubtopic /* SUBTOPIC */
1083 ){
1084 Blob in, line, subsection;
1085 int n = 0;
1086 size_t nSub; /* Length of zSubtopic */
1087 char *zQTop = re_quote(zTopic);
1088 char *zQSub = re_quote(zSubtopic);
1089 char *zPattern = mprintf("> fossil %s .*\\b%s\\b", zQTop, zQSub);
1090 ReCompiled *pRe = 0;
1091
@@ -1144,14 +1143,13 @@
1144
1145 /* If no subtopic name zSubtopic if found, try to match any text.
1146 */
1147 blob_rewind(&in);
1148 blob_init(&subsection, 0, 0);
1149 nSub = (int)strlen(zSubtopic);
1150 while( blob_line(&in, &line) ){
1151 size_t len = blob_strlen(&line);
1152 if( memmem(blob_buffer(&line), len, zSubtopic, nSub)!=0 ){
1153 if( blob_strlen(&subsection) && blob_buffer(&line)[0]!='>' ){
1154 blob_appendb(pOut, &subsection);
1155 blob_reset(&subsection);
1156 }
1157 blob_appendb(pOut, &line);
1158
--- src/dispatch.c
+++ src/dispatch.c
@@ -1081,11 +1081,10 @@
1081 const char *zTopic, /* TOPIC */
1082 const char *zSubtopic /* SUBTOPIC */
1083 ){
1084 Blob in, line, subsection;
1085 int n = 0;
 
1086 char *zQTop = re_quote(zTopic);
1087 char *zQSub = re_quote(zSubtopic);
1088 char *zPattern = mprintf("> fossil %s .*\\b%s\\b", zQTop, zQSub);
1089 ReCompiled *pRe = 0;
1090
@@ -1144,14 +1143,13 @@
1143
1144 /* If no subtopic name zSubtopic if found, try to match any text.
1145 */
1146 blob_rewind(&in);
1147 blob_init(&subsection, 0, 0);
 
1148 while( blob_line(&in, &line) ){
1149 size_t len = blob_strlen(&line);
1150 if( strstr(blob_str(&line), zSubtopic)!=0 ){
1151 if( blob_strlen(&subsection) && blob_buffer(&line)[0]!='>' ){
1152 blob_appendb(pOut, &subsection);
1153 blob_reset(&subsection);
1154 }
1155 blob_appendb(pOut, &line);
1156

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button