Changeset 0d11fc1c in mainline for libc/generic/io/printf_core.c


Ignore:
Timestamp:
2006-06-06T16:37:41Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1249e1
Parents:
63bb83e
Message:

Fixed console disconnect.
Added serialization to printf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/io/printf_core.c

    r63bb83e r0d11fc1c  
    3838#include <ctype.h>
    3939#include <string.h>
     40/* For serialization */
     41#include <async.h>
    4042
    4143#define __PRINTF_FLAG_PREFIX            0x00000001      /**< show prefixes 0x or 0*/
     
    445447        uint64_t flags;
    446448       
     449        /* Don't let other threads interfere */
     450        async_serialize_start();
     451
    447452        counter = 0;
    448453       
     
    453458                        if (i > j) {
    454459                                if ((retval = printf_putnchars(&fmt[j], (size_t)(i - j), ps)) == EOF) { /* error */
    455                                         return -counter;
     460                                        goto minus_out;
    456461                                }
    457462                                counter += retval;
     
    549554                                case 's':
    550555                                        if ((retval = print_string(va_arg(ap, char*), width, precision, flags, ps)) == EOF) {
    551                                                 return -counter;
     556                                                goto minus_out;
    552557                                        };
    553558                                       
     
    558563                                        c = va_arg(ap, unsigned int);
    559564                                        if ((retval = print_char(c, width, flags, ps)) == EOF) {
    560                                                 return -counter;
     565                                                goto minus_out;
    561566                                        };
    562567                                       
     
    639644                                        break;
    640645                                default: /* Unknown qualifier */
    641                                         return -counter;
     646                                        goto minus_out;
    642647                                       
    643648                        }
     
    658663
    659664                        if ((retval = print_number(number, width, precision, base, flags, ps)) == EOF ) {
    660                                 return -counter;
     665                                goto minus_out;
    661666                        };
    662667
     
    671676        if (i > j) {
    672677                if ((retval = printf_putnchars(&fmt[j], (size_t)(i - j), ps)) == EOF) { /* error */
    673                         return -counter;
     678                        goto minus_out;
    674679                }
    675680                counter += retval;
    676681        }
    677682       
     683        async_serialize_end();
    678684        return counter;
     685minus_out:
     686        async_serialize_end();
     687        return -counter;
    679688}
    680689
Note: See TracChangeset for help on using the changeset viewer.