+2007-05-23 Patrick Mansfield <patmans@us.ibm.com>
+
+ * libc/machine/spu/sys/syscall.h: Update the __send_to_ppe
+ prototype.
+ * libc/machine/spu/fclose.c: Use the __send_to_ppe return value
+ instead of the slot 0 value, remove any now unused variables, and
+ for some cases, now store the result in an int vs int*.
+ * libc/machine/spu/feof.c: Ditto.
+ * libc/machine/spu/ferror.c: Ditto.
+ * libc/machine/spu/fflush.c: Ditto.
+ * libc/machine/spu/fgetc.c: Ditto.
+ * libc/machine/spu/fgetpos.c: Ditto.
+ * libc/machine/spu/fgets.c: Ditto.
+ * libc/machine/spu/fileno.c: Ditto.
+ * libc/machine/spu/fopen.c: Ditto.
+ * libc/machine/spu/fprintf.c: Ditto.
+ * libc/machine/spu/fputc.c: Ditto.
+ * libc/machine/spu/fputs.c: Ditto.
+ * libc/machine/spu/fread.c: Ditto.
+ * libc/machine/spu/freopen.c: Ditto.
+ * libc/machine/spu/fscanf.c: Ditto.
+ * libc/machine/spu/fseek.c: Ditto.
+ * libc/machine/spu/fsetpos.c: Ditto.
+ * libc/machine/spu/ftell.c: Ditto.
+ * libc/machine/spu/fwrite.c: Ditto.
+ * libc/machine/spu/getc.c: Ditto.
+ * libc/machine/spu/getchar.c: Ditto.
+ * libc/machine/spu/gets.c: Ditto.
+ * libc/machine/spu/printf.c: Ditto.
+ * libc/machine/spu/putc.c: Ditto.
+ * libc/machine/spu/putchar.c: Ditto.
+ * libc/machine/spu/puts.c: Ditto.
+ * libc/machine/spu/remove.c: Ditto.
+ * libc/machine/spu/rename.c: Ditto.
+ * libc/machine/spu/scanf.c: Ditto.
+ * libc/machine/spu/setvbuf.c: Ditto.
+ * libc/machine/spu/snprintf.c: Ditto.
+ * libc/machine/spu/sprintf.c: Ditto.
+ * libc/machine/spu/sscanf.c: Ditto.
+ * libc/machine/spu/tmpfile.c: Ditto.
+ * libc/machine/spu/tmpnam.c: Ditto.
+ * libc/machine/spu/ungetc.c: Ditto.
+ * libc/machine/spu/vfprintf.c: Ditto.
+ * libc/machine/spu/vfscanf.c: Ditto.
+ * libc/machine/spu/vprintf.c: Ditto.
+ * libc/machine/spu/vscanf.c: Ditto.
+ * libc/machine/spu/vsnprintf.c: Ditto.
+ * libc/machine/spu/vsprintf.c: Ditto.
+ * libc/machine/spu/vsscanf.c: Ditto.
+
2007-05-23 Eric Blake <ebb9@byu.net>
* libc/stdio/vfscanf.c (__SVFSCANF_R): Support scanf(%1$s).
ret = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FCLOSE, &ret);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FCLOSE, &ret);
__sfp_free(fp);
result = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FEOF, &result);
-
-
- return result;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FEOF, &result);
}
#endif /* ! _REENT_ONLY */
result = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FERROR, &result);
-
-
- return result;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FERROR, &result);
}
#endif /* ! _REENT_ONLY */
result = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FFLUSH, &result);
-
-
- return result;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FFLUSH, &result);
}
#endif /* ! _REENT_ONLY */
result = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETC, &result);
-
- return result;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETC, &result);
}
#endif /* ! _REENT_ONLY */
_fpos_t * pos)
{
c99_fgetpos_t arg;
- int* result;
CHECK_INIT(_REENT);
- result = (int*)&arg;
-
arg.fp = fp->_fp;
arg.pos = pos;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETPOS, &arg);
-
-
- return *result;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETPOS, &arg);
}
#endif /* ! _REENT_ONLY */
int n _AND
FILE * fp)
{
- char** ret;
c99_fgets_t args;
CHECK_INIT(_REENT);
args.buf = buf;
args.n = n;
args.fp = fp->_fp;
- ret = (char**) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETS, &args);
-
- return *ret;
+ return (char*) __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETS, &args);
}
#endif /* ! _REENT_ONLY */
ret = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FILENO, &ret);
-
- return ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FILENO, &ret);
}
#endif /* ! _REENT_ONLY */
_CONST char *file _AND
_CONST char *mode)
{
- int *ret;
+ int ret;
c99_fopen_t args;
FILE *fp;
struct _reent *ptr = _REENT;
args.file = file;
args.mode = mode;
- ret = (int *) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FOPEN, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FOPEN, &args);
- if (*ret) {
- fp->_fp = *ret;
+ if (ret) {
+ fp->_fp = ret;
return fp;
}
else {
int
fprintf(FILE * fp, _CONST char *fmt,...)
{
- int* ret;
+ int ret;
c99_fprintf_t args;
CHECK_INIT(_REENT);
- ret = (int*) &args;
-
args.fp = fp->_fp;
args.fmt = (char*) fmt;
va_start (args.ap);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
+ ret =__send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
int c;
register FILE *fp;
{
- int* ret;
c99_fputc_t args;
CHECK_INIT(_REENT);
args.ch = c;
args.fp = fp->_fp;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTC, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTC, &args);
}
#endif /* ! _REENT_ONLY */
char _CONST * s _AND
FILE * fp)
{
- int* ret;
c99_fputs_t args;
CHECK_INIT(_REENT);
args.s = s;
args.fp = fp->_fp;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTS, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTS, &args);
}
#endif /* ! _REENT_ONLY */
size_t count _AND
FILE * fp)
{
- size_t* ret;
c99_fread_t args;
CHECK_INIT(_REENT);
args.size = size;
args.count = count;
args.fp = fp->_fp;
- ret = (size_t*) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREAD, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREAD, &args);
}
#endif /* ! _REENT_ONLY */
const char *mode _AND
FILE *fp)
{
- int *ret;
+ int ret;
c99_freopen_t args;
CHECK_INIT(_REENT);
args.file = file;
args.mode = mode;
args.fp = fp->_fp;
- ret = (int *) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREOPEN, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREOPEN, &args);
- if (*ret) {
- fp->_fp = *ret;
+ if (ret) {
+ fp->_fp = ret;
return fp;
}
else {
fscanf(FILE *fp, _CONST char *fmt, ...)
{
- int* ret;
+ int ret;
c99_vfscanf_t args;
CHECK_INIT(_REENT);
- ret = (int*) &args;
-
args.fp = fp->_fp;
args.fmt = (char*) fmt;
#ifdef _HAVE_STDC
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
long offset _AND
int whence)
{
- int* ret;
c99_fseek_t args;
CHECK_INIT(_REENT);
args.fp = fp->_fp;
args.offset = offset;
args.whence = whence;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSEEK, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSEEK, &args);
}
#endif /* ! _REENT_ONLY */
FILE * iop _AND
_CONST _fpos_t * pos)
{
- int* ret;
c99_fsetpos_t args;
CHECK_INIT(_REENT);
args.fp = iop->_fp;
args.pos = pos;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSETPOS, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSETPOS, &args);
}
#endif /* ! _REENT_ONLY */
ret = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FTELL, &ret);
-
- return ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FTELL, &ret);
}
#endif /* ! _REENT_ONLY */
size_t count _AND
FILE * fp)
{
- size_t* ret;
c99_fwrite_t args;
CHECK_INIT(_REENT);
args.size = size;
args.count = count;
args.fp = fp->_fp;
- ret = (size_t*) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FWRITE, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FWRITE, &args);
}
#endif /* ! _REENT_ONLY */
ret = fp->_fp;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETC, &ret);
-
- return ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETC, &ret);
}
#endif /* ! _REENT_ONLY */
CHECK_STD_INIT(_REENT);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETCHAR, &ret);
-
- return ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETCHAR, &ret);
}
#endif /* ! _REENT_ONLY */
/* The return value gets written over buf
*/
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETS, &buf);
-
- return buf;
+ return (char*) __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETS, &buf);
}
#endif /* ! _REENT_ONLY */
va_dcl
#endif
{
- int* ret;
+ int ret;
c99_printf_t args;
CHECK_STD_INIT(_REENT);
- ret = (int*) &args;
-
args.fmt = fmt;
#ifdef _HAVE_STDC
va_start (args.ap, fmt);
va_start (args.ap);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
int c;
register FILE *fp;
{
- int* ret;
c99_putc_t args;
CHECK_INIT(_REENT);
args.ch = c;
args.fp = fp->_fp;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTC, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTC, &args);
}
#endif /* ! _REENT_ONLY */
/* c gets overwritten before return */
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTCHAR, &c);
-
- return c;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTCHAR, &c);
}
#endif /* ! _REENT_ONLY */
/* The return value gets written over s
*/
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTS, &s);
-
- return (int)s;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTS, &s);
}
#endif /* ! _REENT_ONLY */
/* The return value gets written over buf
*/
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REMOVE, &filename);
-
- return (int)filename;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REMOVE, &filename);
}
_CONST char *old;
_CONST char *new;
{
- int *ret;
c99_rename_t args;
args.old = old;
args.new = new;
- ret = (int*) &args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_RENAME, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_RENAME, &args);
}
scanf(_CONST char *fmt, ...)
{
- int* ret;
+ int ret;
c99_vscanf_t args;
CHECK_STD_INIT(_REENT);
- ret = (int*) &args;
-
args.fmt = (char*) fmt;
#ifdef _HAVE_STDC
va_start (args.ap, fmt);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
int mode _AND
size_t size)
{
- int* ret;
c99_setvbuf_t args;
CHECK_INIT(_REENT);
args.buf = buf;
args.mode = mode;
args.size = size;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETVBUF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETVBUF, &args);
}
#endif /* ! _REENT_ONLY */
size_t size _AND
_CONST char *fmt _DOTS)
{
- int* ret;
+ int ret;
c99_snprintf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.size = size;
args.fmt = fmt;
va_start (args.ap);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
char *str _AND
_CONST char *fmt _DOTS)
{
- int* ret;
+ int ret;
c99_sprintf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.fmt = fmt;
#ifdef _HAVE_STDC
va_start (args.ap);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
_CONST char *str _AND
_CONST char *fmt _DOTS)
{
- int* ret;
+ int ret;
c99_sscanf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.fmt = fmt;
#ifdef _HAVE_STDC
va_start (args.ap);
#endif
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
va_end (args.ap);
- return *ret;
+ return ret;
}
#endif /* ! _REENT_ONLY */
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H
-void __send_to_ppe(unsigned int signalcode, unsigned int opcode, void *data);
+int __send_to_ppe(unsigned int signalcode, unsigned int opcode, void *data);
#endif
return NULL;
}
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret);
+ ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret);
if (ret) {
fp->_fp = ret;
_DEFUN (tmpnam, (s),
char *s)
{
- char **ret = &s;
/* The return value gets written over buf
*/
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPNAM, &s);
-
- return *ret;
+ return (char*) __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPNAM, &s);
}
int c;
register FILE *fp;
{
- int* ret;
c99_ungetc_t args;
CHECK_INIT(_REENT);
args.c = c;
args.fp = fp->_fp;
- ret = (int*)&args;
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_UNGETC, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_UNGETC, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt0 _AND
va_list ap)
{
- int* ret;
c99_vfprintf_t args;
CHECK_INIT(_REENT);
- ret = (int*) &args;
-
args.fp = fp->_fp;
args.fmt = (char*) fmt0;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vfscanf_t args;
CHECK_INIT(_REENT);
- ret = (int*) &args;
-
args.fp = fp->_fp;
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vprintf_t args;
CHECK_STD_INIT(_REENT);
- ret = (int*) &args;
-
args.fmt = fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vscanf_t args;
CHECK_STD_INIT(_REENT);
- ret = (int*) &args;
-
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vsnprintf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.size = size;
args.fmt = fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSNPRINTF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vsprintf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSPRINTF, &args);
}
#endif /* ! _REENT_ONLY */
_CONST char *fmt _AND
va_list ap)
{
- int* ret;
c99_vsscanf_t args;
CHECK_STR_INIT(_REENT);
- ret = (int*) &args;
-
args.str = str;
args.fmt = (char*) fmt;
va_copy(args.ap,ap);
- __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
-
- return *ret;
+ return __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSSCANF, &args);
}
#endif /* ! _REENT_ONLY */