Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Nov 7, 2023
1 parent 2e9c86f commit 60a6974
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
20 changes: 10 additions & 10 deletions w2c2/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ char*
basename(
char* s
) {
size_t i;
size_t i;
if (!s || !*s) {
return ".";
}
i = strlen(s)-1;
i = strlen(s)-1;
for (; i && s[i] == PATH_SEPARATOR; i--) {
s[i] = 0;
}
for (; i && s[i - 1] != PATH_SEPARATOR; i--) { }
return s+i;
return s+i;
}

/*
Expand All @@ -31,17 +31,17 @@ char*
dirname(
char* s
) {
size_t i;
if (!s || !*s) {
size_t i;
if (!s || !*s) {
return ".";
}
i = strlen(s)-1;
for (; s[i] == PATH_SEPARATOR; i--) {
i = strlen(s)-1;
for (; s[i] == PATH_SEPARATOR; i--) {
if (!i) {
return PATH_SEPARATOR_STRING;
}
}
for (; s[i] != PATH_SEPARATOR; i--) {
for (; s[i] != PATH_SEPARATOR; i--) {
if (!i) {
return ".";
}
Expand All @@ -51,8 +51,8 @@ dirname(
return PATH_SEPARATOR_STRING;
}
}
s[i+1] = 0;
return s;
s[i+1] = 0;
return s;
}

#endif /* !HAS_LIBGEN */
1 change: 0 additions & 1 deletion w2c2/leb128_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ testReadU32LEB128() {

if (count == 0 || actual != testCase.expected) {
fprintf(stderr, "FAIL testReadU32LEB128: %u != %u\n", actual, testCase.expected);
} else {
}
}

Expand Down
2 changes: 1 addition & 1 deletion w2c2/typestack.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ wasmTypeStackSet(
typeStack->length = newLength;
}

typeStack->valueTypes[index] |= (1 << valueType);
typeStack->valueTypes[index] |= (WasmValueType)(1 << valueType);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion wasi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ OBJECTS = $(patsubst %.c,%.o,$(filter-out test.c,$(wildcard *.c)))
$(CC) $(CFLAGS) -c $< -o $@

libw2c2wasi.a: $(OBJECTS)
$(AR) rcu $@ $^
$(AR) qc $@ $^
ranlib $@

test: $(OBJECTS) test.c
Expand Down
2 changes: 1 addition & 1 deletion wasi/win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef struct DIR DIR;

DIR* opendir(const char*);
struct dirent* readdir(DIR*);
int closedir(DIR*);
int closedir(DIR*);

/* File types for 'd_type' */
#define DT_UNKNOWN 0
Expand Down

0 comments on commit 60a6974

Please sign in to comment.