[PATCH] trivial fix in get_clockfreq for powerpc

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] trivial fix in get_clockfreq for powerpc

Tom Gall

2006-01-05  Tom Gall  <[hidden email]>

        * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
        Initialize timebase_freq.


diff -uNr libc.orig/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
--- libc.orig/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c 2006-01-06 22:22:34.000000000 +0000
+++ libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c 2006-01-06 22:23:51.000000000 +0000
@@ -32,7 +32,7 @@
      contains at least one line like:
      timebase        : 33333333
      We search for this line and convert the number into an integer.  */
-  static hp_timing_t timebase_freq;
+  static hp_timing_t timebase_freq = 0L;
   hp_timing_t result = 0L;
 
   /* If this function was called before, we know the result.  */

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] trivial fix in get_clockfreq for powerpc

Jakub Jelinek
On Thu, Jan 05, 2006 at 02:18:35PM -0600, Tom Gall wrote:

>
> 2006-01-05  Tom Gall  <[hidden email]>
>
> * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
> Initialize timebase_freq.
>
>
> diff -uNr libc.orig/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
> --- libc.orig/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c 2006-01-06 22:22:34.000000000 +0000
> +++ libc/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c 2006-01-06 22:23:51.000000000 +0000
> @@ -32,7 +32,7 @@
>       contains at least one line like:
>       timebase        : 33333333
>       We search for this line and convert the number into an integer.  */
> -  static hp_timing_t timebase_freq;
> +  static hp_timing_t timebase_freq = 0L;

Fix?  static variables are zero initialized by default...

>    hp_timing_t result = 0L;
>  
>    /* If this function was called before, we know the result.  */

        Jakub

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] trivial fix in get_clockfreq for powerpc

Tom Gall


Gak!  You're right... was entirely focused on the code below the patch.

On Thu, 5 Jan 2006, Jakub Jelinek wrote:

> On Thu, Jan 05, 2006 at 02:18:35PM -0600, Tom Gall wrote:

<unnecessary code fix snipped with great prejudice>

> Fix?  static variables are zero initialized by default...
>
> >    hp_timing_t result = 0L;
> >  
> >    /* If this function was called before, we know the result.  */
>
> Jakub

Regards,

Tom

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] trivial fix in get_clockfreq for powerpc

Ulrich Drepper
In reply to this post by Tom Gall
Tom Gall wrote:
> -  static hp_timing_t timebase_freq;
> +  static hp_timing_t timebase_freq = 0L;

You have to brush up on your C knowledge.  Static variables are
initialized to zero by default.

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


signature.asc (259 bytes) Download Attachment