From 2ad9cf64be4f87d2a3a1faedae4d259896a9ab03 Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Tue, 29 Oct 2024 14:37:43 +0100 Subject: [PATCH] src: Remove trailing spaces --- src/allocator.c | 6 +++--- src/code.c | 16 ++++++++-------- src/jit.c | 26 +++++++++++++------------- src/main.c | 2 +- src/std/array.c | 4 ++-- src/std/error.c | 2 +- src/std/maps.h | 2 +- src/std/obj.c | 2 +- src/std/sys.c | 2 +- src/std/sys_android.c | 4 ++-- src/std/sys_ios.m | 2 +- src/std/track.c | 8 ++++---- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/allocator.c b/src/allocator.c index 3020748db..f38235fb4 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -239,7 +239,7 @@ static void flush_free_list( gc_pheader *ph ) { int k; for(k=0;kfree.count;k++) { gc_fl *fl = GET_FL(&p->free,k); - printf("(%d-%d)",fl->pos,fl->pos+fl->count-1); + printf("(%d-%d)",fl->pos,fl->pos+fl->count-1); } printf("\n"); } @@ -255,7 +255,7 @@ static void flush_free_list( gc_pheader *ph ) { is_free = true; } } - bool is_marked = ((ph->bmp[bid>>3] & (1<<(bid&7))) != 0); + bool is_marked = ((ph->bmp[bid>>3] & (1<<(bid&7))) != 0); if( is_marked && is_free ) { // check if it was already free before for(k=0;kfun = (hl_type_fun*)hl_zalloc(&r->code->alloc,sizeof(hl_type_fun)); t->fun->nargs = nargs; t->fun->args = (hl_type**)hl_malloc(&r->code->alloc,sizeof(hl_type*)*nargs); @@ -386,7 +386,7 @@ static int *hl_read_debug_infos( hl_reader *r, int nops ) { int curfile = -1, curline = 0; hl_code *code = r->code; int *debug = (int*)hl_malloc(&code->alloc, sizeof(int) * nops * 2); - int i = 0; + int i = 0; while( i < nops ) { int c = READ(); if( c & 1 ) { @@ -423,7 +423,7 @@ static int *hl_read_debug_infos( hl_reader *r, int nops ) { } hl_code *hl_code_read( const unsigned char *data, int size, char **error_msg ) { - hl_reader _r = { data, size, 0, 0, NULL }; + hl_reader _r = { data, size, 0, 0, NULL }; hl_reader *r = &_r; hl_code *c; hl_alloc alloc; @@ -446,14 +446,14 @@ hl_code *hl_code_read( const unsigned char *data, int size, char **error_msg ) { c->nints = UINDEX(); c->nfloats = UINDEX(); c->nstrings = UINDEX(); - if( c->version >= 5 ) + if( c->version >= 5 ) c->nbytes = UINDEX(); c->ntypes = UINDEX(); c->nglobals = UINDEX(); c->nnatives = UINDEX(); c->nfunctions = UINDEX(); c->nconstants = c->version >= 4 ? UINDEX() : 0; - c->entrypoint = UINDEX(); + c->entrypoint = UINDEX(); c->hasdebug = flags & 1; CHK_ERROR(); ALLOC(c->ints, int, c->nints); @@ -606,7 +606,7 @@ static const unsigned int crc32_table[] = #define H(b) hash = (hash >> 8) ^ crc32_table[(hash ^ (b)) & 0xFF] #define H32(i) { H(i&0xFF); H((i>>8)&0xFF); H((i>>16)&0xFF); H(((unsigned int)i)>>24); } -#define HFUN(idx) H32(h->functions_signs[h->functions_indexes[idx]]); +#define HFUN(idx) H32(h->functions_signs[h->functions_indexes[idx]]); #define HSTR(s) { const char *_c = s; while( *_c ) H(*_c++); } #define HUSTR(s) { const uchar *_c = s; while( *_c ) H(*_c++); } #define HTYPE(t) if( !isrec ) H32(hash_type_first(t,true)) @@ -924,11 +924,11 @@ hl_code_hash *hl_code_hash_alloc( hl_code *c ) { case HOBJ: case HSTRUCT: if( t->obj->global_value ) - h->globals_signs[(int)(int_val)t->obj->global_value - 1] = hl_code_hash_type(h,t); + h->globals_signs[(int)(int_val)t->obj->global_value - 1] = hl_code_hash_type(h,t); break; case HENUM: if( t->tenum->global_value ) - h->globals_signs[(int)(int_val)t->tenum->global_value - 1] = hl_code_hash_type(h,t); + h->globals_signs[(int)(int_val)t->tenum->global_value - 1] = hl_code_hash_type(h,t); break; default: break; diff --git a/src/jit.c b/src/jit.c index e1be3c44b..535ab6978 100644 --- a/src/jit.c +++ b/src/jit.c @@ -316,7 +316,7 @@ struct jit_ctx { # ifdef HL_DEBUG # define error_i64() jit_error("i64-32") # else -void error_i64() { +void error_i64() { printf("The module you are loading is using 64 bit ints that are not supported by the HL32.\nPlease run using HL64 or compile with -D hl-legacy32"); jit_exit(); } @@ -607,12 +607,12 @@ static void op( jit_ctx *ctx, CpuOp o, preg *a, preg *b, bool mode64 ) { int_val cval = b->holds ? (int_val)b->holds : b->id; // short byte form if( f->r_i8 && IS_SBYTE(cval) ) { - if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4; + if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4; OP(f->r_i8); if( (f->r_i8&FLAG_DUAL) ) MOD_RM(3,a->id,a->id); else MOD_RM(3,GET_RM(f->r_i8)-1,a->id); B((int)cval); } else if( GET_RM(f->r_const) > 0 || (f->r_const&FLAG_DUAL) ) { - if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4; + if( (f->r_i8&FLAG_DUAL) && a->id > 7 ) r64 |= 4; OP(f->r_const&0xFF); if( (f->r_i8&FLAG_DUAL) ) MOD_RM(3,a->id,a->id); else MOD_RM(3,GET_RM(f->r_const)-1,a->id); if( mode64 && IS_64 && o == MOV ) W64(cval); else W((int)cval); @@ -1073,7 +1073,7 @@ static preg *fetch32( jit_ctx *ctx, vreg *r ) { return fetch(r); } -// make sure higher bits are zeroes +// make sure higher bits are zeroes static preg *alloc_cpu64( jit_ctx *ctx, vreg *r, bool andLoad ) { # ifndef HL_64 return alloc_cpu(ctx,r,andLoad); @@ -2417,7 +2417,7 @@ static void jit_c2hl( jit_ctx *ctx ) { op64(ctx,MOV,PEBP,PESP); # ifdef HL_64 - + fptr = REG_AT(R10); stack = PEAX; stend = REG_AT(R11); @@ -2554,7 +2554,7 @@ static void jit_hl2c( jit_ctx *ctx ) { // case HF32: case HF64: return jit_wrapper_d(arg0,&args); // default: return jit_wrapper_ptr(arg0,&args); // } - if( !IS_64 ) + if( !IS_64 ) op64(ctx,MOV,cl,pmem(&p,Ebp,HL_WSIZE*2)); // load arg0 op64(ctx,MOV,tmp,pmem(&p,cl->id,0)); // ->t op64(ctx,MOV,tmp,pmem(&p,tmp->id,HL_WSIZE)); // ->fun @@ -2566,7 +2566,7 @@ static void jit_hl2c( jit_ctx *ctx ) { op32(ctx,CMP,tmp,pconst(&p,HF32)); XJump_small(JEq,jfloat2); - // 64 bits : ESP + EIP (+WIN64PAD) + // 64 bits : ESP + EIP (+WIN64PAD) // 32 bits : ESP + EIP + PARAM0 int args_pos = IS_64 ? ((IS_WINCALL64 ? 32 : 0) + HL_WSIZE * 2) : (HL_WSIZE*3); @@ -2897,7 +2897,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { vreg *r = R(i); int creg = select_call_reg(&cregs,r->t,i); if( creg < 0 || IS_WINCALL64 ) { - // use existing stack storage + // use existing stack storage r->stackPos = argsSize + HL_WSIZE * 2; argsSize += stack_size(r->t); } else { @@ -3050,7 +3050,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { preg *pb = alloc_cpu(ctx,ra,true); op64(ctx,XOR,pa,pa); op64(ctx,SUB,pa,pb); - store(ctx,dst,pa,true); + store(ctx,dst,pa,true); # else error_i64(); # endif @@ -3313,7 +3313,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { ctx->calls = j; set_native_arg(ctx,pconst64(&p,RESERVE_ADDRESS)); - set_native_arg(ctx,pconst64(&p,(int_val)m->code->functions[m->functions_indexes[o->p2]].type)); + set_native_arg(ctx,pconst64(&p,(int_val)m->code->functions[m->functions_indexes[o->p2]].type)); call_native(ctx,hl_alloc_closure_ptr,size); store(ctx,dst,PEAX,true); } @@ -3403,7 +3403,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { { int regids[64]; preg *pc = REG_AT(CALL_REGS[0]); - vreg *sc = R(f->nregs); // scratch register that we temporary rebind + vreg *sc = R(f->nregs); // scratch register that we temporary rebind if( o->p3 >= 63 ) jit_error("assert"); memcpy(regids + 1, o->extra, o->p3 * sizeof(int)); regids[0] = f->nregs; @@ -3442,7 +3442,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { error_i64(); break; } -# endif +# endif switch( ra->t->kind ) { case HOBJ: case HSTRUCT: @@ -3707,7 +3707,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) { // keep o->value in R(f->nregs) int regids[64]; preg *pc = alloc_reg(ctx,RCPU_CALL); - vreg *sc = R(f->nregs); // scratch register that we temporary rebind + vreg *sc = R(f->nregs); // scratch register that we temporary rebind if( o->p3 >= 63 ) jit_error("assert"); memcpy(regids, o->extra, o->p3 * sizeof(int)); regids[0] = f->nregs; diff --git a/src/main.c b/src/main.c index 3e80f30ac..9ff3d07af 100644 --- a/src/main.c +++ b/src/main.c @@ -251,7 +251,7 @@ int main(int argc, pchar *argv[]) { } hl_module_free(ctx.m); hl_free(&ctx.code->alloc); - // do not call hl_unregister_thread() or hl_global_free will display error + // do not call hl_unregister_thread() or hl_global_free will display error // on global_lock if there are threads that are still running (such as debugger) hl_global_free(); return 0; diff --git a/src/std/array.c b/src/std/array.c index 95c690506..574367b29 100644 --- a/src/std/array.c +++ b/src/std/array.c @@ -37,8 +37,8 @@ HL_PRIM varray *hl_alloc_array( hl_type *at, int size ) { } HL_PRIM void hl_array_blit( varray *dst, int dpos, varray *src, int spos, int len ) { - int size = hl_type_size(dst->at); - memmove( hl_aptr(dst,vbyte) + dpos * size, hl_aptr(src,vbyte) + spos * size, len * size); + int size = hl_type_size(dst->at); + memmove( hl_aptr(dst,vbyte) + dpos * size, hl_aptr(src,vbyte) + spos * size, len * size); } HL_PRIM hl_type *hl_array_type( varray *a ) { diff --git a/src/std/error.c b/src/std/error.c index b8314d029..9ebfbf408 100644 --- a/src/std/error.c +++ b/src/std/error.c @@ -118,7 +118,7 @@ HL_PRIM void hl_null_access() { } HL_PRIM void hl_throw_buffer( hl_buffer *b ) { - vdynamic *d = hl_alloc_dynamic(&hlt_bytes); + vdynamic *d = hl_alloc_dynamic(&hlt_bytes); d->v.ptr = hl_buffer_content(b,NULL); hl_throw(d); } diff --git a/src/std/maps.h b/src/std/maps.h index 02bc060f3..1d9db22b0 100644 --- a/src/std/maps.h +++ b/src/std/maps.h @@ -28,7 +28,7 @@ typedef struct { } t_map; #ifndef _MNO_EXPORTS -HL_PRIM +HL_PRIM #endif t_map *_MNAME(alloc)() { t_map *m = (t_map*)hl_gc_alloc_raw(sizeof(t_map)); diff --git a/src/std/obj.c b/src/std/obj.c index b50f40bf0..7201e8d16 100644 --- a/src/std/obj.c +++ b/src/std/obj.c @@ -701,7 +701,7 @@ static void hl_dynobj_delete_field( vdynobj *o, hl_field_lookup *f ) { int i; unsigned int order = hl_dynobj_order(f); int index = f->field_index & HL_DYNOBJ_INDEX_MASK; - bool is_ptr = hl_is_ptr(f->t); + bool is_ptr = hl_is_ptr(f->t); // erase data if( is_ptr ) { memmove(o->values + index, o->values + index + 1, (o->nvalues - (index + 1)) * sizeof(void*)); diff --git a/src/std/sys.c b/src/std/sys.c index 78ad1ad72..4ceeba827 100644 --- a/src/std/sys.c +++ b/src/std/sys.c @@ -151,7 +151,7 @@ HL_PRIM void hl_sys_print( vbyte *msg ) { hl_blocking(true); # if defined(HL_XBO) || defined(HL_XBS) OutputDebugStringW((LPCWSTR)msg); -# else +# else # ifdef HL_WIN_DESKTOP if( print_flags & PR_WIN_UTF8 ) _setmode(_fileno(stdout),_O_U8TEXT); # endif diff --git a/src/std/sys_android.c b/src/std/sys_android.c index 938bf5f7a..df9519539 100644 --- a/src/std/sys_android.c +++ b/src/std/sys_android.c @@ -114,7 +114,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) if (!hl_java_method_id_get_context) { __android_log_print(ANDROID_LOG_ERROR, HL_JNI_LOG_TAG, "Error cannot get getContext() method on specified Activity class (not an Activity ?)"); } - + return JNI_VERSION_1_4; } @@ -227,7 +227,7 @@ static const char* hl_sys_android_get_internal_storage_path(void) return hl_android_internal_files_path; } -const char *hl_sys_special( const char *key ) { +const char *hl_sys_special( const char *key ) { if (strcmp(key, "android_external_storage_path")==0) return hl_sys_android_get_external_storage_path(); else if (strcmp(key, "android_internal_storage_path")==0) diff --git a/src/std/sys_ios.m b/src/std/sys_ios.m index bfee2d69b..602d0453e 100644 --- a/src/std/sys_ios.m +++ b/src/std/sys_ios.m @@ -54,7 +54,7 @@ static int ios_get_retina_scale_factor() return [[UIScreen mainScreen] scale]; } -const char *hl_sys_special( const char *key ) { +const char *hl_sys_special( const char *key ) { if (strcmp(key, "ios_resource_path")==0) return ios_get_resource_path(); else if (strcmp(key, "ios_document_path")==0) diff --git a/src/std/track.c b/src/std/track.c index 6fac834ac..34c10128b 100644 --- a/src/std/track.c +++ b/src/std/track.c @@ -237,10 +237,10 @@ HL_PRIM int hl_track_entry( int id, hl_type **t, int *count, int *info, varray * count_before += cur->bcount; cur++; } - b = cur->buckets + (id - count_before); + b = cur->buckets + (id - count_before); prev_id++; } else { - int i; + int i; count_before = 0; for(i=0;i<_KLAST;i++) { bucket_list *data = &all_data[i]; @@ -251,7 +251,7 @@ HL_PRIM int hl_track_entry( int id, hl_type **t, int *count, int *info, varray * prev_id = id; cur = &all_data[i]; b = cur->buckets; - } + } *t = b->t; *count = b->hit_count; *info = b->info; @@ -276,7 +276,7 @@ HL_PRIM void hl_track_set_bits( int flags, bool thread ) { # ifdef HL_TRACK_ENABLE if( thread ) { hl_thread_info *t = hl_get_thread(); - if( t ) t->flags = (t->flags & ~(HL_TRACK_MASK<flags = (t->flags & ~(HL_TRACK_MASK<