From 43d7c1e807f03b373e03c3a25d68ebd4cbc06d73 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 3 Jun 2020 02:57:39 +0800 Subject: [PATCH] libc: Add IPTR for puts/fputs Signed-off-by: Xiang Xiao Change-Id: I2a83afb4d934a44ad1b56ec6dd72e654f4e112a3 --- include/stdio.h | 4 ++-- libs/libc/libc.csv | 4 ++-- libs/libc/stdio/lib_fputs.c | 10 +++++----- libs/libc/stdio/lib_puts.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index 5931ac91a74..0b2684b42a5 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -153,7 +153,7 @@ FAR char *fgets(FAR char *s, int n, FAR FILE *stream); FAR FILE *fopen(FAR const char *path, FAR const char *type); int fprintf(FAR FILE *stream, FAR const IPTR char *format, ...); int fputc(int c, FAR FILE *stream); -int fputs(FAR const char *s, FAR FILE *stream); +int fputs(FAR const IPTR char *s, FAR FILE *stream); size_t fread(FAR void *ptr, size_t size, size_t n_items, FAR FILE *stream); FAR FILE *freopen(FAR const char *path, FAR const char *mode, FAR FILE *stream); @@ -178,7 +178,7 @@ int ungetc(int c, FAR FILE *stream); void perror(FAR const char *s); int printf(FAR const IPTR char *fmt, ...); -int puts(FAR const char *s); +int puts(FAR const IPTR char *s); int rename(FAR const char *oldpath, FAR const char *newpath); int sprintf(FAR char *buf, FAR const IPTR char *fmt, ...); int asprintf(FAR char **ptr, FAR const IPTR char *fmt, ...); diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv index d10d3c20368..6b1f87a0e44 100644 --- a/libs/libc/libc.csv +++ b/libs/libc/libc.csv @@ -44,7 +44,7 @@ "fopen","stdio.h","CONFIG_NFILE_STREAMS > 0","FAR FILE *","FAR const char *","FAR const char *" "fprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const IPTR char *","..." "fputc","stdio.h","CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *" -"fputs","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *" +"fputs","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const IPTR char *","FAR FILE *" "fread","stdio.h","CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *" "free","stdlib.h","","void","FAR void *" "fseek","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","long int","int" @@ -136,7 +136,7 @@ "pthread_mutexattr_settype","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_PTHREAD_MUTEX_TYPES)","int","FAR pthread_mutexattr_t *","int" "pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)" "pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void" -"puts","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const char *" +"puts","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const IPTR char *" "qsort","stdlib.h","","void","FAR void *","size_t","size_t","int(*)(FAR const void *","FAR const void *)" "rand","stdlib.h","","int" "readdir_r","dirent.h","","int","FAR DIR *","FAR struct dirent *","FAR struct dirent **" diff --git a/libs/libc/stdio/lib_fputs.c b/libs/libc/stdio/lib_fputs.c index 1c7a78b829b..94eb0a710d1 100644 --- a/libs/libc/stdio/lib_fputs.c +++ b/libs/libc/stdio/lib_fputs.c @@ -1,7 +1,8 @@ /**************************************************************************** * libs/libc/stdio/lib_fputs.c * - * Copyright (C) 2007, 2008, 2011-2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008, 2011-2012, 2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -60,7 +61,7 @@ ****************************************************************************/ #if defined(CONFIG_ARCH_ROMGETC) -int fputs(FAR const char *s, FAR FILE *stream) +int fputs(FAR const IPTR char *s, FAR FILE *stream) { int nput; int ret; @@ -104,7 +105,7 @@ int fputs(FAR const char *s, FAR FILE *stream) } #else -int fputs(FAR const char *s, FAR FILE *stream) +int fputs(FAR const IPTR char *s, FAR FILE *stream) { int nput; @@ -151,7 +152,7 @@ int fputs(FAR const char *s, FAR FILE *stream) } } - /* Without line buffering, we can write the whole string in one operation. */ + /* We can write the whole string in one operation without line buffering */ else { @@ -172,7 +173,6 @@ int fputs(FAR const char *s, FAR FILE *stream) { return EOF; } - } return nput; diff --git a/libs/libc/stdio/lib_puts.c b/libs/libc/stdio/lib_puts.c index a70e31a34db..a50907148da 100644 --- a/libs/libc/stdio/lib_puts.c +++ b/libs/libc/stdio/lib_puts.c @@ -52,7 +52,7 @@ * ****************************************************************************/ -int puts(FAR const char *s) +int puts(FAR const IPTR char *s) { FILE *stream = stdout; int nwritten;