Skip to content
Commit 8ef44442 authored by Radim Krčmář's avatar Radim Krčmář
Browse files

libcflat: fix padding in printf



A simple test:

  printf(".%8p.\n",  (void *)0);
  printf(".%-8p.\n", (void *)0);
  printf(".%8p.\n",  (void *)1);
  printf(".%-8p.\n", (void *)1);
  printf(".%8p.\n",  (void *)0x123456);
  printf(".%-8p.\n", (void *)0x123456);

  printf(".%2p.\n",  (void *)0);
  printf(".%-2p.\n", (void *)0);
  printf(".%2p.\n",  (void *)1);
  printf(".%-2p.\n", (void *)1);

glibc:

  .   (nil).
  .(nil)   .
  .     0x1.
  .0x1     .
  .0x123456.
  .0x123456.
  .(nil).
  .(nil).
  .0x1.
  .0x1.

before patch:

  .      0x       0.
  .0x      0       .
  .      0x       1.
  .0x      1       .
  .      0x  123456.
  .0x      123456  .
  .0x 0.
  .0x0 .
  .0x 1.
  .0x1 .

after patch:

  .       0.
  .0       .
  .     0x1.
  .0x1     .
  .0x123456.
  .0x123456.
  . 0.
  .0 .
  .0x1.
  .0x1.

(nil) would be possible with a small change, but the standard leaves it
to the implementation and 0 is acceptable, IMO.

Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 4a3245a1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment