Skip to content

Commit 869cb5f

Browse files
authored
Merge pull request #106 from memreflect/bugfix-compilation
Compilation fixes
2 parents 6a6492a + 674f31f commit 869cb5f

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

es.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ extern Tree *parse(char *esprompt1, char *esprompt2);
284284
extern Tree *parsestring(const char *str);
285285
extern void sethistory(char *file);
286286
extern Boolean isinteractive(void);
287+
#if ABUSED_GETENV
288+
#if READLINE
289+
extern void initgetenv(void);
290+
#endif
291+
#endif
287292
extern void initinput(void);
288293
extern void resetparser(void);
289294

@@ -375,7 +380,7 @@ extern void gc(void); /* provoke a collection, if enabled */
375380
extern void gcreserve(size_t nbytes); /* provoke a collection, if enabled and not enough space */
376381
extern void gcenable(void); /* enable collections */
377382
extern void gcdisable(void); /* disable collections */
378-
extern Boolean gcisblocked(); /* is collection disabled? */
383+
extern Boolean gcisblocked(void); /* is collection disabled? */
379384

380385

381386
/*

input.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ static char *esgetenv(const char *name) {
255255
}
256256

257257
static char *
258-
stdgetenv(name)
259-
register const char *name;
258+
stdgetenv(const char *name)
260259
{
261260
extern char **environ;
262261
register int len;
@@ -276,7 +275,7 @@ stdgetenv(name)
276275
}
277276

278277
char *
279-
getenv(char *name)
278+
getenv(const char *name)
280279
{
281280
return realgetenv(name);
282281
}
@@ -618,7 +617,7 @@ static List *(*wordslistgen)(char *);
618617
static char *list_completion_function(const char *text, int state) {
619618
static char **matches = NULL;
620619
static int matches_idx, matches_len;
621-
int rlen;
620+
int i, rlen;
622621
char *result;
623622

624623
const int pfx_len = strlen(complprefix);
@@ -637,7 +636,7 @@ static char *list_completion_function(const char *text, int state) {
637636

638637
rlen = strlen(matches[matches_idx]);
639638
result = ealloc(rlen + pfx_len + 1);
640-
for (int i = 0; i < pfx_len; i++)
639+
for (i = 0; i < pfx_len; i++)
641640
result[i] = complprefix[i];
642641
strcpy(&result[pfx_len], matches[matches_idx]);
643642
result[rlen + pfx_len] = '\0';

syntax.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ extern Tree *redirappend(Tree *tree, Tree *r) {
234234

235235
/* mkmatch -- rewrite match as appropriate if with ~ commands */
236236
extern Tree *mkmatch(Tree *subj, Tree *cases) {
237+
const char *varname = "matchexpr";
238+
Tree *matches = NULL;
239+
Tree *sass, *svar;
237240
/*
238241
* Empty match -- with no patterns to match the subject,
239242
* it's like saying {if}, which simply returns true.
@@ -246,16 +249,15 @@ extern Tree *mkmatch(Tree *subj, Tree *cases) {
246249
* repeatedly by assigning it to a temporary variable and using that
247250
* variable as the first argument to '~' .
248251
*/
249-
const char *varname = "matchexpr";
250-
Tree *sass = treecons2(mk(nAssign, mk(nWord, varname), subj), NULL);
251-
Tree *svar = mk(nVar, mk(nWord, varname));
252-
Tree *matches = NULL;
252+
sass = treecons2(mk(nAssign, mk(nWord, varname), subj), NULL);
253+
svar = mk(nVar, mk(nWord, varname));
253254
for (; cases != NULL; cases = cases->CDR) {
255+
Tree *match;
254256
Tree *pattlist = cases->CAR->CAR;
255257
Tree *cmd = cases->CAR->CDR;
256258
if (pattlist != NULL && pattlist->kind != nList)
257259
pattlist = treecons(pattlist, NULL);
258-
Tree *match = treecons(
260+
match = treecons(
259261
thunkify(mk(nMatch, svar, pattlist)),
260262
treecons(cmd, NULL)
261263
);

0 commit comments

Comments
 (0)