Skip to content

Commit 95f6446

Browse files
committed
Updated workflow files
1 parent 5ef74b3 commit 95f6446

File tree

5 files changed

+52
-44
lines changed

5 files changed

+52
-44
lines changed

.github/workflows/linux.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ jobs:
2525
cmake --version
2626
2727
- name: Build with script
28-
run: ./build.sh --install --clean
28+
run: ./build.sh --install
2929

3030
- name: Build with CMake
3131
run: |
32-
mkdir -p build
32+
rm -rf build
33+
mkdir build
3334
cd build
3435
cmake ..
3536
make

.github/workflows/macos.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ jobs:
2525
cmake --version
2626
2727
- name: Build with script
28-
run: ./build.sh --install --clean
28+
run: ./build.sh --install
2929

3030
- name: Build with CMake
3131
run: |
32-
mkdir -p build
32+
mkdir build
33+
rm -rf build
3334
cd build
3435
cmake ..
3536
make

src/sys/search.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ void XSearch_FreeEntry(xsearch_entry_t *pEntry)
9393
}
9494
}
9595

96-
static void XFile_ArrayClearCb(xarray_data_t *pItem)
96+
static void XSearch_ArrayClearCb(xarray_data_t *pItem)
9797
{
9898
if (pItem == NULL) return;
9999
free(pItem->pData);
100100
}
101101

102-
static int XFile_ErrorCallback(xsearch_t *pSearch, const char *pStr, ...)
102+
static int XSearch_ErrorCallback(xsearch_t *pSearch, const char *pStr, ...)
103103
{
104104
if (pSearch == NULL) return XSTDERR;
105105
else if (pSearch->callback == NULL) return XSTDOK;
@@ -120,7 +120,7 @@ static int XFile_ErrorCallback(xsearch_t *pSearch, const char *pStr, ...)
120120
return XSTDOK;
121121
}
122122

123-
static int XSearchCallback(xsearch_t *pSearch, xsearch_entry_t *pEntry)
123+
static int XSearch_Callback(xsearch_t *pSearch, xsearch_entry_t *pEntry)
124124
{
125125
if (pSearch == NULL || pEntry == NULL) return XSTDERR;
126126

@@ -131,7 +131,7 @@ static int XSearchCallback(xsearch_t *pSearch, xsearch_entry_t *pEntry)
131131
{
132132
if (XArray_AddData(&pSearch->fileArray, pEntry, 0) < 0)
133133
{
134-
XFile_ErrorCallback(pSearch, "Failed to append entry: %s%s", pEntry->sPath, pEntry->sName);
134+
XSearch_ErrorCallback(pSearch, "Failed to append entry: %s%s", pEntry->sPath, pEntry->sName);
135135
return XSTDERR;
136136
}
137137

@@ -148,7 +148,7 @@ static int XSearchCallback(xsearch_t *pSearch, xsearch_entry_t *pEntry)
148148
return XSTDNON;
149149
}
150150

151-
static xbool_t XSearchTokens(xarray_t *pTokens, const char *pName, size_t nLength)
151+
static xbool_t XSearch_Tokens(xarray_t *pTokens, const char *pName, size_t nLength)
152152
{
153153
size_t nUsed = XArray_Used(pTokens);
154154
if (!nUsed) return XFALSE;
@@ -175,7 +175,7 @@ static xbool_t XSearchTokens(xarray_t *pTokens, const char *pName, size_t nLengt
175175
return XTRUE;
176176
}
177177

178-
static xbool_t XSearchMulty(xarray_t *pTokens, const char *pName, size_t nLength)
178+
static xbool_t XSearch_Multy(xarray_t *pTokens, const char *pName, size_t nLength)
179179
{
180180
size_t i, nCount = XArray_Used(pTokens);
181181
xbool_t bFound = XFALSE;
@@ -187,25 +187,25 @@ static xbool_t XSearchMulty(xarray_t *pTokens, const char *pName, size_t nLength
187187

188188
bFound = pArrData->nKey != XSTDOK ?
189189
xstrncmp((const char *)pArrData->pData, pName, nLength) :
190-
XSearchTokens((xarray_t*)pArrData->pData, pName, nLength);
190+
XSearch_Tokens((xarray_t*)pArrData->pData, pName, nLength);
191191

192192
if (bFound) break;
193193
}
194194

195195
return bFound;
196196
}
197197

198-
static xbool_t XSearchName(xsearch_t *pSearch, const char *pFileName)
198+
static xbool_t XSearch_Name(xsearch_t *pSearch, const char *pFileName)
199199
{
200200
size_t nLength = strlen(pFileName);
201201
xbool_t bFound = pSearch->bMulty ?
202-
XSearchMulty(&pSearch->nameTokens, pFileName, nLength) :
203-
XSearchTokens(&pSearch->nameTokens, pFileName, nLength);
202+
XSearch_Multy(&pSearch->nameTokens, pFileName, nLength) :
203+
XSearch_Tokens(&pSearch->nameTokens, pFileName, nLength);
204204

205205
return bFound;
206206
}
207207

208-
static XSTATUS XSearchLines(xsearch_t *pSearch, xsearch_context_t *pCtx)
208+
static XSTATUS XSearch_Lines(xsearch_t *pSearch, xsearch_context_t *pCtx)
209209
{
210210
XSTATUS nStatus = XSTDNON;
211211
xarray_t *pArr = xstrsplite(pCtx->pBuffer, XSTR_NEW_LINE);
@@ -221,7 +221,7 @@ static XSTATUS XSearchLines(xsearch_t *pSearch, xsearch_context_t *pCtx)
221221
xsearch_entry_t *pEntry = XSearch_NewEntry(pCtx->pName, pCtx->pPath, pCtx->pStat);
222222
if (pEntry == NULL)
223223
{
224-
XFile_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
224+
XSearch_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
225225
XArray_Destroy(pArr);
226226
return XSTDERR;
227227
}
@@ -230,7 +230,7 @@ static XSTATUS XSearchLines(xsearch_t *pSearch, xsearch_context_t *pCtx)
230230
pEntry->nLineNum = i + 1;
231231
nStatus = XSTDOK;
232232

233-
if (XSearchCallback(pSearch, pEntry) < 0)
233+
if (XSearch_Callback(pSearch, pEntry) < 0)
234234
{
235235
XArray_Destroy(pArr);
236236
return XSTDERR;
@@ -244,13 +244,13 @@ static XSTATUS XSearchLines(xsearch_t *pSearch, xsearch_context_t *pCtx)
244244
xsearch_entry_t *pEntry = XSearch_NewEntry(pCtx->pName, pCtx->pPath, pCtx->pStat);
245245
if (pEntry == NULL)
246246
{
247-
XFile_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
247+
XSearch_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
248248
XArray_Destroy(pArr);
249249
return XSTDERR;
250250
}
251251

252252
xstrncpy(pEntry->sLine, sizeof(pEntry->sLine), "Binary file matches");
253-
if (XSearchCallback(pSearch, pEntry) < 0)
253+
if (XSearch_Callback(pSearch, pEntry) < 0)
254254
{
255255
XArray_Destroy(pArr);
256256
return XSTDERR;
@@ -261,7 +261,7 @@ static XSTATUS XSearchLines(xsearch_t *pSearch, xsearch_context_t *pCtx)
261261
return XSTDNON;
262262
}
263263

264-
static XSTATUS XSearchBuffer(xsearch_t *pSearch, xsearch_context_t *pCtx)
264+
static XSTATUS XSearch_Buffer(xsearch_t *pSearch, xsearch_context_t *pCtx)
265265
{
266266
const char *pData = pCtx->pBuffer;
267267
size_t nLength = pCtx->nLength;
@@ -281,12 +281,12 @@ static XSTATUS XSearchBuffer(xsearch_t *pSearch, xsearch_context_t *pCtx)
281281
xsearch_entry_t *pEntry = XSearch_NewEntry(pCtx->pName, pCtx->pPath, pCtx->pStat);
282282
if (pEntry == NULL)
283283
{
284-
XFile_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
284+
XSearch_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
285285
return XSTDERR;
286286
}
287287

288288
xstrncpy(pEntry->sLine, sizeof(pEntry->sLine), sLine);
289-
if (XSearchCallback(pSearch, pEntry) < 0) return XSTDERR;
289+
if (XSearch_Callback(pSearch, pEntry) < 0) return XSTDERR;
290290

291291
nStatus = XSTDOK;
292292
pCtx->nPosit += nEnd;
@@ -302,18 +302,18 @@ static XSTATUS XSearchBuffer(xsearch_t *pSearch, xsearch_context_t *pCtx)
302302
xsearch_entry_t *pEntry = XSearch_NewEntry(pCtx->pName, pCtx->pPath, pCtx->pStat);
303303
if (pEntry == NULL)
304304
{
305-
XFile_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
305+
XSearch_ErrorCallback(pSearch, "Failed to alloc entry: %s", pCtx->pPath);
306306
return XSTDERR;
307307
}
308308

309309
xstrncpy(pEntry->sLine, sizeof(pEntry->sLine), "Binary file matches");
310-
if (XSearchCallback(pSearch, pEntry) < 0) return XSTDERR;
310+
if (XSearch_Callback(pSearch, pEntry) < 0) return XSTDERR;
311311
}
312312

313313
return XSTDNON;
314314
}
315315

316-
static XSTATUS XSearchText(xsearch_t *pSearch, const char *pPath, const char *pName, xstat_t *pStat)
316+
static XSTATUS XSearch_Text(xsearch_t *pSearch, const char *pPath, const char *pName, xstat_t *pStat)
317317
{
318318
char sPath[XPATH_MAX];
319319
xbyte_buffer_t buffer;
@@ -343,15 +343,15 @@ static XSTATUS XSearchText(xsearch_t *pSearch, const char *pPath, const char *pN
343343
ctx.pStat = pStat;
344344

345345
nStatus = pSearch->bSearchLines ?
346-
XSearchLines(pSearch, &ctx) :
347-
XSearchBuffer(pSearch, &ctx);
346+
XSearch_Lines(pSearch, &ctx) :
347+
XSearch_Buffer(pSearch, &ctx);
348348
}
349349

350350
XByteBuffer_Clear(&buffer);
351351
return nStatus;
352352
}
353353

354-
static XSTATUS XFile_CheckCriteria(xsearch_t *pSearch, const char *pPath, const char *pName, xstat_t *pStat)
354+
static XSTATUS XSearch_CheckCriteria(xsearch_t *pSearch, const char *pPath, const char *pName, xstat_t *pStat)
355355
{
356356
if (pSearch->nLinkCount >= 0 && pSearch->nLinkCount != pStat->st_nlink) return XSTDNON;
357357
if (pSearch->nFileSize >= 0 && pSearch->nFileSize != pStat->st_size) return XSTDNON;
@@ -378,7 +378,7 @@ static XSTATUS XFile_CheckCriteria(xsearch_t *pSearch, const char *pPath, const
378378
const char *pSearchName = pSearch->bInsensitive ? (const char *)sName : pName;
379379

380380
xbool_t bFound = pSearch->nameTokens.nUsed ?
381-
XSearchName(pSearch, pSearchName) :
381+
XSearch_Name(pSearch, pSearchName) :
382382
xstrcmp(pSearch->sName, pSearchName);
383383

384384
if (!bFound) return XSTDNON;
@@ -389,21 +389,21 @@ static XSTATUS XFile_CheckCriteria(xsearch_t *pSearch, const char *pPath, const
389389
xfile_type_t eType = XFile_GetType(pStat->st_mode);
390390
if (eType != XF_REGULAR) return XSTDNON;
391391

392-
XSTATUS nStatus = XSearchText(pSearch, pPath, pName, pStat);
392+
XSTATUS nStatus = XSearch_Text(pSearch, pPath, pName, pStat);
393393
if (nStatus <= XSTDNON) return nStatus;
394394
}
395395

396396
return XSTDOK;
397397
}
398398

399-
void XSearchClearCb(xarray_data_t *pArrData)
399+
void XSearch_ClearCb(xarray_data_t *pArrData)
400400
{
401401
if (pArrData == NULL || pArrData->pData == NULL) return;
402402
if (!pArrData->nKey) xfree(pArrData->pPool, pArrData->pData);
403403
else XArray_Destroy((xarray_t*)pArrData->pData);
404404
}
405405

406-
static size_t XFile_TokenizeName(xsearch_t *pSrcCtx, const char *pFileName)
406+
static size_t XSearch_TokenizeName(xsearch_t *pSrcCtx, const char *pFileName)
407407
{
408408
xarray_t *pTokens = &pSrcCtx->nameTokens;
409409
if (xstrsrc(pFileName, ";") >= 0) xstrsplita(pFileName, ";", pTokens, XFALSE, XFALSE);
@@ -425,7 +425,7 @@ static size_t XFile_TokenizeName(xsearch_t *pSrcCtx, const char *pFileName)
425425
pArrData->pData = pSubTokens;
426426
pArrData->nKey = XSTDOK;
427427

428-
pTokens->clearCb = XSearchClearCb;
428+
pTokens->clearCb = XSearch_ClearCb;
429429
xfree(pTokens->pPool, pToken);
430430
}
431431
}
@@ -448,13 +448,13 @@ void XSearch_Init(xsearch_t *pSrcCtx, const char *pFileName)
448448
XArray_InitPool(&pSrcCtx->nameTokens, XSTDNON, XSTDNON, XFALSE);
449449
XArray_InitPool(&pSrcCtx->fileArray, XSTDNON, XSTDNON, XFALSE);
450450

451-
pSrcCtx->fileArray.clearCb = XFile_ArrayClearCb;
452-
pSrcCtx->nameTokens.clearCb = XSearchClearCb;
451+
pSrcCtx->fileArray.clearCb = XSearch_ArrayClearCb;
452+
pSrcCtx->nameTokens.clearCb = XSearch_ClearCb;
453453

454454
pSrcCtx->sName[0] = XSTR_NUL;
455455
pSrcCtx->sText[0] = XSTR_NUL;
456456

457-
XFile_TokenizeName(pSrcCtx, pFileName);
457+
XSearch_TokenizeName(pSrcCtx, pFileName);
458458
xstrncpy(pSrcCtx->sName, sizeof(pSrcCtx->sName), pFileName);
459459

460460
pSrcCtx->nBufferSize = 0;
@@ -471,8 +471,8 @@ void XSearch_Destroy(xsearch_t *pSrcCtx)
471471
XASSERT_VOID_RET(pSrcCtx);
472472
XSYNC_ATOMIC_SET(pSrcCtx->pInterrupted, 1);
473473

474-
pSrcCtx->nameTokens.clearCb = XSearchClearCb;
475-
pSrcCtx->fileArray.clearCb = XFile_ArrayClearCb;
474+
pSrcCtx->nameTokens.clearCb = XSearch_ClearCb;
475+
pSrcCtx->fileArray.clearCb = XSearch_ArrayClearCb;
476476

477477
XArray_Destroy(&pSrcCtx->fileArray);
478478
XArray_Destroy(&pSrcCtx->nameTokens);
@@ -499,7 +499,7 @@ int XSearch(xsearch_t *pSearch, const char *pDirectory)
499499

500500
if (XDir_Open(&dirHandle, sDirPath) < 0)
501501
{
502-
XFile_ErrorCallback(pSearch, "Failed to open directory: %s", sDirPath);
502+
XSearch_ErrorCallback(pSearch, "Failed to open directory: %s", sDirPath);
503503
return XSYNC_ATOMIC_GET(pSearch->pInterrupted) ? XSTDERR : XSTDOK;
504504
}
505505

@@ -519,23 +519,23 @@ int XSearch(xsearch_t *pSearch, const char *pDirectory)
519519

520520
if (xstat(sFullPath, &statbuf) < 0)
521521
{
522-
XFile_ErrorCallback(pSearch, "Failed to stat file: %s", sFullPath);
522+
XSearch_ErrorCallback(pSearch, "Failed to stat file: %s", sFullPath);
523523
if (XSYNC_ATOMIC_GET(pSearch->pInterrupted)) return XSTDERR;
524524
continue;
525525
}
526526

527-
int nMatch = XFile_CheckCriteria(pSearch, sDirPath, pEntryName, &statbuf);
527+
int nMatch = XSearch_CheckCriteria(pSearch, sDirPath, pEntryName, &statbuf);
528528
if (nMatch > 0)
529529
{
530530
xsearch_entry_t *pEntry = XSearch_NewEntry(pEntryName, sDirPath, &statbuf);
531531
if (pEntry == NULL)
532532
{
533-
XFile_ErrorCallback(pSearch, "Failed to alloc entry: %s", sFullPath);
533+
XSearch_ErrorCallback(pSearch, "Failed to alloc entry: %s", sFullPath);
534534
XDir_Close(&dirHandle);
535535
return XSTDERR;
536536
}
537537

538-
if (XSearchCallback(pSearch, pEntry) < 0)
538+
if (XSearch_Callback(pSearch, pEntry) < 0)
539539
{
540540
XDir_Close(&dirHandle);
541541
return XSTDERR;

src/xver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#define XUTILS_VERSION_MAX 2
1414
#define XUTILS_VERSION_MIN 6
15-
#define XUTILS_BUILD_NUMBER 37
15+
#define XUTILS_BUILD_NUMBER 38
1616

1717
#ifdef __cplusplus
1818
extern "C" {

tools/xutils.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
int main()
1515
{
1616
xlog_defaults();
17+
18+
#ifdef _XUTILS_USE_SSL
19+
xlog("libxutils - v%s (OpenSSL)", XUtils_Version());
20+
#else
1721
xlog("libxutils - v%s", XUtils_Version());
22+
#endif
23+
1824
return XSTDNON;
1925
}

0 commit comments

Comments
 (0)