Skip to content
  • Radim Krčmář's avatar
    libcflat: fix padding in printf · 8ef44442
    Radim Krčmář authored
    
    
    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>
    8ef44442