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

Antoine Kaufmann ·

Am Sonntag, 20. Januar 2008 13.04:21 schrieb 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.

Ich habe die Funktionen jetzt in die time.c übernommen, und die anderen 
vorgeschlagenen Änderungen durchgeführt.


-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : libc_time2.patch
Dateityp    : text/x-diff
Dateigröße  : 7967 bytes
Beschreibung: nicht verfügbar
URL         : <http://list.tyndur.org/pipermail/tyndur-devel/attachments/20080120/fee65a65/attachment.patch>

Anhänge

Antworten