Skip to content
Snippets Groups Projects
Commit 2ec247f3 authored by Anders Lindh Olsson's avatar Anders Lindh Olsson :8ball:
Browse files

Apply pre-commit

parent bbc76373
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ int vasprintf(char** pbuffer, const char* format, va_list ap) ...@@ -29,7 +29,7 @@ int vasprintf(char** pbuffer, const char* format, va_list ap)
#ifdef va_copy #ifdef va_copy
va_end(ap2); va_end(ap2);
#endif #endif
if (len <= 0) if (len <= 0)
{ {
fprintf(stderr, "vasprintf: error calculating needed size\n"); fprintf(stderr, "vasprintf: error calculating needed size\n");
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (c) 2002 The Regents of the University of California, as * Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory. * Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found * EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution. * in file LICENSE that is included with this distribution.
\*************************************************************************/ \*************************************************************************/
/* dbLoadTemplate.h */ /* dbLoadTemplate.h */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (c) 2006 UChicago, as Operator of Argonne * Copyright (c) 2006 UChicago, as Operator of Argonne
* National Laboratory. * National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found * EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution. * in file LICENSE that is included with this distribution.
\*************************************************************************/ \*************************************************************************/
/* for vasprintf */ /* for vasprintf */
...@@ -47,7 +47,7 @@ extern void dbLoadRecords(const char*, const char*); ...@@ -47,7 +47,7 @@ extern void dbLoadRecords(const char*, const char*);
#endif #endif
#if (EPICS_VERSION*10000+EPICS_REVISION*100+EPICS_MODIFICATION>=31600) #if (EPICS_VERSION*10000+EPICS_REVISION*100+EPICS_MODIFICATION>=31600)
#define dbmfStrdup(s) dbmfStrdup((char*)s) #define dbmfStrdup(s) dbmfStrdup((char*)s)
#endif #endif
static int line_num; static int line_num;
...@@ -348,9 +348,9 @@ variable_definition: WORD EQUALS WORD ...@@ -348,9 +348,9 @@ variable_definition: WORD EQUALS WORD
; ;
%% %%
#include "dbLoadTemplate_lex.c" #include "dbLoadTemplate_lex.c"
static int yyerror(char* str) static int yyerror(char* str)
{ {
if (str) if (str)
...@@ -369,7 +369,7 @@ int dbLoadTemplate(const char *sub_file, const char *cmd_collect, const char *pa ...@@ -369,7 +369,7 @@ int dbLoadTemplate(const char *sub_file, const char *cmd_collect, const char *pa
int i; int i;
line_num = 1; line_num = 1;
if (!sub_file || !*sub_file) { if (!sub_file || !*sub_file) {
fprintf(stderr, "must specify variable substitution file\n"); fprintf(stderr, "must specify variable substitution file\n");
return -1; return -1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Copyright (c) 2006 UChicago, as Operator of Argonne * Copyright (c) 2006 UChicago, as Operator of Argonne
* National Laboratory. * National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found * EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution. * in file LICENSE that is included with this distribution.
\*************************************************************************/ \*************************************************************************/
newline "\n" newline "\n"
......
...@@ -77,7 +77,7 @@ static long ipow(long base, long exp) ...@@ -77,7 +77,7 @@ static long ipow(long base, long exp)
{ {
long val; long val;
if (exp == 2) return base*base; if (exp == 2) return base*base;
if (exp == 3) return base*base*base; if (exp == 3) return base*base*base;
if (exp == 1) return base; if (exp == 1) return base;
if (exp == 0) return 1; if (exp == 0) return 1;
if (exp < 0) return 0; if (exp < 0) return 0;
...@@ -114,7 +114,7 @@ struct {char str[4]; int pr;} ops[] = { ...@@ -114,7 +114,7 @@ struct {char str[4]; int pr;} ops[] = {
enum op { enum op {
op_none, op_none,
op_pow, op_pow,
op_mul,op_div,op_mod, op_mul,op_div,op_mod,
op_plus,op_minus, op_plus,op_minus,
op_lshift,op_urshift,op_rshift, op_lshift,op_urshift,op_rshift,
......
...@@ -46,13 +46,13 @@ int runScript(const char* filename, const char* args) ...@@ -46,13 +46,13 @@ int runScript(const char* filename, const char* args)
int status = 0; int status = 0;
char* old_MODULE = NULL; char* old_MODULE = NULL;
char* old_MODULE_DIR = NULL; char* old_MODULE_DIR = NULL;
if (!filename) if (!filename)
{ {
fprintf(stderr, "Usage: runScript filename [macro=value,...]\n"); fprintf(stderr, "Usage: runScript filename [macro=value,...]\n");
return -1; return -1;
} }
if (macCreateHandle(&mac,(const char*[]){ "", "environ", NULL, NULL }) != 0) goto error; if (macCreateHandle(&mac,(const char*[]){ "", "environ", NULL, NULL }) != 0) goto error;
macSuppressWarning(mac, 1); macSuppressWarning(mac, 1);
...@@ -80,7 +80,7 @@ int runScript(const char* filename, const char* args) ...@@ -80,7 +80,7 @@ int runScript(const char* filename, const char* args)
char* fullname; char* fullname;
const char* path = getenv("SCRIPT_PATH"); const char* path = getenv("SCRIPT_PATH");
int dirlen; int dirlen;
for (dirname = path; dirname != NULL; dirname = end) for (dirname = path; dirname != NULL; dirname = end)
{ {
end = strchr(dirname, OSI_PATH_LIST_SEPARATOR[0]); end = strchr(dirname, OSI_PATH_LIST_SEPARATOR[0]);
...@@ -90,7 +90,7 @@ int runScript(const char* filename, const char* args) ...@@ -90,7 +90,7 @@ int runScript(const char* filename, const char* args)
else dirlen = (int)strlen(dirname); else dirlen = (int)strlen(dirname);
if (dirlen == 0) continue; /* ignore empty path elements */ if (dirlen == 0) continue; /* ignore empty path elements */
if (dirname[dirlen-1] == OSI_PATH_SEPARATOR[0]) dirlen--; if (dirname[dirlen-1] == OSI_PATH_SEPARATOR[0]) dirlen--;
asprintf(&fullname, "%.*s" OSI_PATH_SEPARATOR "%s", asprintf(&fullname, "%.*s" OSI_PATH_SEPARATOR "%s",
dirlen, dirname, filename); dirlen, dirname, filename);
if (runScriptDebug) if (runScriptDebug)
printf("runScript: trying %s\n", fullname); printf("runScript: trying %s\n", fullname);
...@@ -101,7 +101,7 @@ int runScript(const char* filename, const char* args) ...@@ -101,7 +101,7 @@ int runScript(const char* filename, const char* args)
} }
} }
if (file == NULL) { perror(filename); return errno; } if (file == NULL) { perror(filename); return errno; }
/* save some environments variables */ /* save some environments variables */
SAVEENV(MODULE); SAVEENV(MODULE);
SAVEENV(MODULE_DIR); SAVEENV(MODULE_DIR);
...@@ -136,7 +136,7 @@ int runScript(const char* filename, const char* args) ...@@ -136,7 +136,7 @@ int runScript(const char* filename, const char* args)
p = line_exp; p = line_exp;
while (isspace((unsigned char)*p)) p++; while (isspace((unsigned char)*p)) p++;
if (*p == 0 || *p == '#') continue; if (*p == 0 || *p == '#') continue;
/* find local variable assignments */ /* find local variable assignments */
if ((x = strpbrk(p, "=(, \t\n\r")) != NULL && *x=='=') if ((x = strpbrk(p, "=(, \t\n\r")) != NULL && *x=='=')
{ {
...@@ -186,7 +186,7 @@ void afterInitHook(initHookState state) ...@@ -186,7 +186,7 @@ void afterInitHook(initHookState state)
{ {
struct cmditem *item; struct cmditem *item;
if (state != if (state !=
#ifdef INCinitHooksh #ifdef INCinitHooksh
/* old: without iocPause etc */ /* old: without iocPause etc */
initHookAfterInterruptAccept initHookAfterInterruptAccept
...@@ -223,7 +223,7 @@ static struct cmditem *newItem(char* cmd, int type) ...@@ -223,7 +223,7 @@ static struct cmditem *newItem(char* cmd, int type)
{ {
fprintf(stderr, "afterInit can only be used before iocInit\n"); fprintf(stderr, "afterInit can only be used before iocInit\n");
return NULL; return NULL;
} }
if (first_time) if (first_time)
{ {
first_time = 0; first_time = 0;
...@@ -246,7 +246,7 @@ int afterInit(char* cmd, char* a1, char* a2, char* a3, char* a4, char* a5, char* ...@@ -246,7 +246,7 @@ int afterInit(char* cmd, char* a1, char* a2, char* a3, char* a4, char* a5, char*
{ {
struct cmditem *item = newItem(cmd, 0); struct cmditem *item = newItem(cmd, 0);
if (!item) return -1; if (!item) return -1;
item->x.a[0] = cmd; item->x.a[0] = cmd;
item->x.a[1] = a1; item->x.a[1] = a1;
item->x.a[2] = a2; item->x.a[2] = a2;
...@@ -271,7 +271,7 @@ static const iocshFuncDef runScriptDef = { ...@@ -271,7 +271,7 @@ static const iocshFuncDef runScriptDef = {
&(iocshArg) { "filename", iocshArgString }, &(iocshArg) { "filename", iocshArgString },
&(iocshArg) { "substitutions", iocshArgString }, &(iocshArg) { "substitutions", iocshArgString },
}}; }};
static void runScriptFunc(const iocshArgBuf *args) static void runScriptFunc(const iocshArgBuf *args)
{ {
runScript(args[0].sval, args[1].sval); runScript(args[0].sval, args[1].sval);
...@@ -281,7 +281,7 @@ static const iocshFuncDef afterInitDef = { ...@@ -281,7 +281,7 @@ static const iocshFuncDef afterInitDef = {
"afterInit", 1, (const iocshArg *[]) { "afterInit", 1, (const iocshArg *[]) {
&(iocshArg) { "commandline", iocshArgArgv }, &(iocshArg) { "commandline", iocshArgArgv },
}}; }};
static void afterInitFunc(const iocshArgBuf *args) static void afterInitFunc(const iocshArgBuf *args)
{ {
int i, n; int i, n;
......
...@@ -12,7 +12,7 @@ char *strndup(const char *s, size_t n) ...@@ -12,7 +12,7 @@ char *strndup(const char *s, size_t n)
{ {
size_t l; size_t l;
char *d; char *d;
l = strlen(s); l = strlen(s);
if (n > l) n = l; if (n > l) n = l;
d = malloc(n+1); d = malloc(n+1);
......
...@@ -9,4 +9,4 @@ typedef struct semver_t { ...@@ -9,4 +9,4 @@ typedef struct semver_t {
void cleanup_semver(semver_t *s); void cleanup_semver(semver_t *s);
int parse_semver(const char *version, semver_t *s); int parse_semver(const char *version, semver_t *s);
\ No newline at end of file
...@@ -12,7 +12,7 @@ x=10+3, 10-3, 10*3, 10/3, 10%3, 10**3 ...@@ -12,7 +12,7 @@ x=10+3, 10-3, 10*3, 10/3, 10%3, 10**3
x=7**-2 7**-1 7**0 7**1 7**2 7**3 7**4 7**5 7**6 x=7**-2 7**-1 7**0 7**1 7**2 7**3 7**4 7**5 7**6
# $(x) should be: 0 0 1 7 49 343 2401 16807 117649 # $(x) should be: 0 0 1 7 49 343 2401 16807 117649
x=%x -10<<2, %x -10>>2, %x -10>>>2 x=%x -10<<2, %x -10>>2, %x -10>>>2
# $(x) should be: ffffffffffffffd8, fffffffffffffffd, 3ffffffffffffffd # $(x) should be: ffffffffffffffd8, fffffffffffffffd, 3ffffffffffffffd
x=%x 0xaa & 0x0f, %x 0xaa | 0x0f, %x 0xaa ^ 0x0f x=%x 0xaa & 0x0f, %x 0xaa | 0x0f, %x 0xaa ^ 0x0f
...@@ -27,7 +27,7 @@ x=20<20 20<=20 20==20 20>=20 20>20 20<=>20 20<?20 20>?20 20?<20 20?>20 ...@@ -27,7 +27,7 @@ x=20<20 20<=20 20==20 20>=20 20>20 20<=>20 20<?20 20>?20 20?<20 20?>20
x=20<10 20<=10 20==10 20>=10 20>10 20<=>10 20<?10 20>?10 20?<10 20?>10 x=20<10 20<=10 20==10 20>=10 20>10 20<=>10 20<?10 20>?10 20?<10 20?>10
# $(x) should be: 0 0 0 1 1 1 10 20 1 0 # $(x) should be: 0 0 0 1 1 1 10 20 1 0
x= (0|0)(0|1)(1|0)(1|1) (0&0)(0&1)(1&0)(1&1) (0^0)(0^1)(1^0)(1^1) x= (0|0)(0|1)(1|0)(1|1) (0&0)(0&1)(1&0)(1&1) (0^0)(0^1)(1^0)(1^1)
# $(x) should be: 0111 0001 0110 # $(x) should be: 0111 0001 0110
x=1*2*3+4*5*6-7-8 x=1*2*3+4*5*6-7-8
......
...@@ -16,4 +16,3 @@ $ iocsh.bash e3_local/cmds/iocStats.cmd ...@@ -16,4 +16,3 @@ $ iocsh.bash e3_local/cmds/iocStats.cmd
In this case, In this case,
```E3_CMD_TOP``` is defined as ```"${HOME}/e3_local/cmds"``` ```E3_CMD_TOP``` is defined as ```"${HOME}/e3_local/cmds"```
```E3_IOCSH_TOP``` is defined as ```"${HOME}"``` ```E3_IOCSH_TOP``` is defined as ```"${HOME}"```
...@@ -38,7 +38,7 @@ proc opendbd {name} { ...@@ -38,7 +38,7 @@ proc opendbd {name} {
scanmatch $global_context {^[ \t]*(#|%|$)} { scanmatch $global_context {^[ \t]*(#|%|$)} {
continue continue
} }
if {$recordtypes} { if {$recordtypes} {
scanmatch $global_context {include[ \t]+"?((.*)Record.dbd)"?} { scanmatch $global_context {include[ \t]+"?((.*)Record.dbd)"?} {
...@@ -96,7 +96,7 @@ proc includeFile {context filename} { ...@@ -96,7 +96,7 @@ proc includeFile {context filename} {
#puts "#include $filename from $FileName($matchInfo(handle))" #puts "#include $filename from $FileName($matchInfo(handle))"
scanfile $context $file scanfile $context $file
close $file close $file
} }
foreach filename $argv { foreach filename $argv {
global filesDone quiet global filesDone quiet
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment