[Lost] [Patch] Stubs für die wichtigsten Zeitfunktionen

Kevin Wolf ·

Antoine Kaufmann schrieb:
>  
>  time_t time();

Wird zwar nicht von diesem Patch geändert, aber das sollte doch time_t 
time(time_t *tloc) sein?

> Index: src/modules/lib/stdlibc/localtime.c
> ===================================================================
> --- src/modules/lib/stdlibc/localtime.c	(Revision 0)
> +++ src/modules/lib/stdlibc/localtime.c	(Revision 0)

Werden die Funktionen, wenn sie implementiert sind, wirklich so 
umfangreich, daß man sie auf verschiedene Dateien aufteilen muß? 
Ansonsten würde ich eine time.c bevorzugen.

> +#include <sys/types.h>
> +#include <time.h>
> +#include <errno.h>
> +#include <config.h>
> +
> +
> +#ifndef CONFIG_LIBC_NO_STUBS
> +struct tm tm;

static und am besten mit auffälligen Werten initialisiert.

> +#ifndef CONFIG_LIBC_NO_STUBS
> +char* asctime_buf = "Wed Jun 30 21:49:08 1993\n";

Hier dasselbe. Dein Defaultwert ist alles andere als gut. Nimm besser 
einen 31. Februar 9999 oder so, wenn ein wirklich guter String wie 
"[asctime() nicht implementiert]" Programme verwirren würde (würde es?)

> Index: src/modules/lib/stdlibc/gmtime.c
> ===================================================================
> --- src/modules/lib/stdlibc/gmtime.c	(Revision 692)
> +++ src/modules/lib/stdlibc/gmtime.c	(Arbeitskopie)
> @@ -36,7 +36,9 @@
>  #include <sys/types.h>
>  #include <time.h>
>  #include <string.h>
> +#include <config.h>
>  
> +#ifndef CONFIG_LIBC_NO_STUBS
>  struct tm tm;

static

> Index: src/modules/lib/stdlibc/ctime.c
> ===================================================================
> --- src/modules/lib/stdlibc/ctime.c	(Revision 692)
> +++ src/modules/lib/stdlibc/ctime.c	(Arbeitskopie)
> @@ -35,7 +35,10 @@
>  
>  #include <sys/types.h>
>  #include <time.h>
> +#include <config.h>
>  
> +#ifndef CONFIG_LIBC_NO_STUBS
> +
>  char* ctime_string = "Wed Jun 42 13:37:42 1337\n";

Na also, geht doch. *g*

Aber auch der sollte static sein.

Antworten