Skip to content

Commit 23db183

Browse files
committed
Add addBuildOpt helper function for building option string
addBuildOpt should be called with the build option which is NOT surrounded by spaces since it will add spaces to separate options itself, if necessary.
1 parent 7471dcb commit 23db183

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/library/blas/generic/common.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <clkern.h>
2323
#include <cltypes.h>
2424
#include <stdio.h>
25+
#include <ctype.h>
2526

2627
#include "clblas-internal.h"
2728

@@ -537,6 +538,22 @@ setupBuildOpts(
537538
}
538539
}
539540

541+
void addBuildOpt(
542+
char * opts,
543+
size_t len,
544+
const char * option)
545+
{
546+
size_t l = strlen(opts);
547+
548+
if (l > 0 && !isspace(opts[l-1]) && l+1 < len) {
549+
opts[l] = ' ';
550+
opts[l+1] = '\0';
551+
}
552+
553+
strlcat(opts, option, len);
554+
}
555+
556+
540557
char VISIBILITY_HIDDEN
541558
*sprintfGranulation(char *buf, const SubproblemDim *dim, int level)
542559
{

src/library/blas/include/clblas-internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ setupBuildOpts(
240240
cl_device_id devID,
241241
MemoryPattern *mempat);
242242

243+
void addBuildOpt(
244+
char * opts,
245+
size_t len,
246+
const char * option);
247+
243248
// Internal scatter image API
244249

245250
int

0 commit comments

Comments
 (0)