fixes to remove gcc initialization warnings with -On

This commit is contained in:
Alex Shinn 2010-09-20 20:21:59 +09:00
parent 9d8788414f
commit 078ee010aa
5 changed files with 9 additions and 8 deletions

View file

@ -15,7 +15,7 @@ static void sexp_write_pointer (sexp ctx, void *p, sexp out) {
}
static sexp disasm (sexp ctx, sexp self, sexp bc, sexp out, int depth) {
sexp tmp;
sexp tmp=NULL;
unsigned char *ip, opcode, i;
if (sexp_procedurep(bc)) {
@ -94,7 +94,7 @@ static sexp disasm (sexp ctx, sexp self, sexp bc, sexp out, int depth) {
}
sexp_write_char(ctx, '\n', out);
if ((opcode == SEXP_OP_PUSH) && (depth < SEXP_DISASM_MAX_DEPTH)
&& (sexp_bytecodep(tmp) || sexp_procedurep(tmp)))
&& tmp && (sexp_bytecodep(tmp) || sexp_procedurep(tmp)))
disasm(ctx, self, tmp, out, depth+1);
if (ip - sexp_bytecode_data(bc) < sexp_bytecode_length(bc))
goto loop;

View file

@ -523,8 +523,10 @@ sexp sexp_scheduler (sexp ctx sexp_api_params(self, n), sexp root_thread) {
/* either wait on an fd, or just sleep */
pollfds = sexp_global(res, SEXP_G_THREADS_POLL_FDS);
if (sexp_portp(sexp_context_event(res)) && sexp_pollfdsp(pollfds)) {
if ((k = poll(sexp_pollfds_fds(pollfds), sexp_pollfds_num_fds(pollfds), usecs/1000)) > 0)
if ((k = poll(sexp_pollfds_fds(pollfds), sexp_pollfds_num_fds(pollfds), usecs/1000)) > 0) {
pfds = sexp_pollfds_fds(pollfds);
goto unblock_io_threads;
}
} else {
usleep(usecs);
sexp_context_waitp(res) = 0;

View file

@ -203,6 +203,7 @@ static sexp sexp_sort_x (sexp ctx sexp_api_params(self, n), sexp seq,
sexp_qsort(ctx, data, 0, len-1);
if (sexp_opcodep(less) && sexp_opcode_inverse(less))
sexp_vector_nreverse(ctx, vec);
res = vec;
} else if (! (sexp_procedurep(less) || sexp_opcodep(less))) {
res = sexp_type_exception(ctx, self, SEXP_PROCEDURE, less);
} else if (! (sexp_procedurep(key) || sexp_opcodep(key) || sexp_not(key))) {
@ -212,10 +213,8 @@ static sexp sexp_sort_x (sexp ctx sexp_api_params(self, n), sexp seq,
}
}
if (sexp_pairp(seq))
if (sexp_pairp(seq) && ! sexp_exceptionp(res))
res = sexp_vector_copy_to_list(ctx, vec, seq);
else if (! sexp_exceptionp(res))
res = vec;
sexp_gc_release1(ctx);
return res;

2
main.c
View file

@ -110,7 +110,7 @@ static sexp sexp_load_standard_repl_env (sexp ctx, sexp env, sexp k) {
void run_main (int argc, char **argv) {
char *arg, *impmod, *p;
sexp env, out=SEXP_FALSE, res=SEXP_VOID, ctx=NULL;
sexp out=SEXP_FALSE, res=SEXP_VOID, env=NULL, ctx=NULL;
sexp_sint_t i, j, len, quit=0, print=0, init_loaded=0;
sexp_uint_t heap_size=0;
sexp_gc_var2(tmp, args);

2
sexp.c
View file

@ -771,7 +771,7 @@ sexp sexp_substring_op (sexp ctx sexp_api_params(self, n), sexp str, sexp start,
sexp sexp_string_concatenate_op (sexp ctx sexp_api_params(self, n), sexp str_ls, sexp sep) {
sexp res, ls;
sexp_uint_t len=0, i=0, sep_len=0;
char *p, *csep;
char *p, *csep=NULL;
for (ls=str_ls; sexp_pairp(ls); ls=sexp_cdr(ls), i++)
if (! sexp_stringp(sexp_car(ls)))
return sexp_type_exception(ctx, self, SEXP_STRING, sexp_car(ls));