Skip to content

Commit f1ab88b

Browse files
committed
Fix return incompatiable bug
1 parent 5a6d869 commit f1ab88b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/slib.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ OPT char* ultoaS(unsigned long value, char* string, int radix);
281281
D_TESTING OPT int colorprintf(enum cpfcolors fcolor,ccp format,...);
282282

283283

284-
D_TESTING OPT void *getret(mtret ret);
284+
OPT void *getret(mtret *ret);
285285

286286

287-
D_TESTING OPT mtret mkret(size_t lenth,...);
287+
OPT mtret *mkret(size_t lenth,...);
288288

289289
#if ! PLAT
290290
OPT int getch(void);

main/mret.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@
2525
#include "slib.h"
2626
int retind=0;
2727

28-
mtret mkret(size_t lenth,...)
28+
mtret *mkret(size_t lenth,...)
2929
{
30-
mtret ret;
30+
mtret *ret;
3131
void **elems=malloc(sizeof(int*)*lenth);
3232
int count=0;
3333
va_list args;
3434
if(elems==NULL)
3535
{
3636
serr=1;
37-
return SERROR;
37+
return NULL;
3838
}
3939
va_start(args,lenth);
4040

41-
ret.lenth=lenth;
41+
ret->lenth=lenth;
4242
for(;count<lenth;++count)
4343
{
4444
elems[count]=va_arg(args,int*);
4545
}
46-
ret.val=elems;
46+
ret->val=elems;
4747
va_end(args);
4848
free(elems);
4949
return ret;
5050
}
5151

5252

53-
void *getret(mtret ret)
53+
void *getret(mtret *ret)
5454
{
55-
return retind<ret.lenth?ret.val[retind++]:NULL;
55+
return retind<ret->lenth?ret->val[retind++]:NULL;
5656
}

0 commit comments

Comments
 (0)