[bug #49447] Example code for uart_putchar() has error in recursive call

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #49447] Example code for uart_putchar() has error in recursive call

Joerg Wunsch-6
URL:
  <http://savannah.nongnu.org/bugs/?49447>

                 Summary: Example code for uart_putchar() has error in
recursive call
                 Project: AVR C Runtime Library
            Submitted by: normandunbar
            Submitted on: Wed 26 Oct 2016 11:57:57 AM GMT
                Category: Documentation
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Documentation
                  Status: None
        Percent Complete: 0%
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 2.0.0
           Fixed Release: None

    _______________________________________________________

Details:

Good Afternoon All,

I have checked the bug database for anything relating to uart_putchar() and
found two references that do not cover the following.

In the example code given in Note 2 for "Running stdio without malloc()" in
the section covering the "<stdio.h>" header features, the recursive call to
uart_putchar() is missing the second "stream" parameter.

The example given is:


int
uart_putchar(char c, FILE *stream)
{
  if (c == '\n')
    uart_putchar('\r');
  loop_until_bit_is_set(UCSRA, UDRE);
  UDR = c;
  return 0;
}


And I'm sure it should be:


int
uart_putchar(char c, FILE *stream)
{
  if (c == '\n')
    uart_putchar('\r', stream);
    ...
}


The example given just prior to the above section is correct in that it does
pass the second parameter.

Cheers,
Norm.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?49447>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #49447] Example code for uart_putchar() has error in recursive call

Joerg Wunsch-6
Update of bug #49447 (project avr-libc):

                  Status:                    None => Fixed                  
             Assigned to:                    None => joerg_wunsch          
             Open/Closed:                    Open => Closed                
           Fixed Release:                    None => 2.0.1                  

    _______________________________________________________

Follow-up Comment #1:

Thanks for catching this.  Fixing it was simple. ;-)

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?49447>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #49447] Example code for uart_putchar() has error in recursive call

Joerg Wunsch-6
Follow-up Comment #2, bug #49447 (project avr-libc):

No worries. Thanks for all the hard work.

Cheers,
Norm.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?49447>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
Loading...