src/lib/edit.c
char *edit_uint64(uint64_t val, char *buf)
{
   /*
    * Replacement for sprintf(buf, "%" llu, val)
    */
   char mbuf[50];
   mbuf[sizeof(mbuf)-1] = 0;
   int i = sizeof(mbuf)-2;                 /* edit backward */
   if (val == 0) {
      mbuf[i--] = '0';
   } else {
      while (val != 0) {
         mbuf[i--] = "0123456789"[val%10];
         val /= 10;
      }
   }
   bstrncpy(buf, &mbuf[i+1], 27);
   return buf;
}
/*
 * Edit an integer number, the supplied buffer
 * must be at least 27 bytes long.  The incoming number
 * is always widened to 64 bits.
 */
Edit an integer number, the supplied buffer
must be at least 27 bytes long.  The incoming number
is always widened to 64 bits.
Edit an integer number the supplied buffer must be at least 27 bytes long . The incoming number is always widened to 64 bits .
char *edit_uint64(uint64_t val, char *buf)
{
   char mbuf[50];
   mbuf[sizeof(mbuf)-1] = 0;
   int i = sizeof(mbuf)-2;                 
   if (val == 0) {
      mbuf[i--] = '0';
   } else {
      while (val != 0) {
         mbuf[i--] = "0123456789"[val%10];
         val /= 10;
      }
   }
   bstrncpy(buf, &mbuf[i+1], 27);
   return buf;
}
char * edit_uint64 ( uint64_t val , char * buf ) { char mbuf [ 50 ] ; mbuf [ sizeof ( mbuf ) - 1 ] = 0 ; int i = sizeof ( mbuf ) - 2 ; if ( val == 0 ) { mbuf [ i -- ] = ' ' ; } else { while ( val != 0 ) { mbuf [ i -- ] = " " [ val % 10 ] ; val /= 10 ; } } bstrncpy ( buf , & mbuf [ i + 1 ] , 27 ) ; return buf ; }
Edit an integer number, the supplied buffer
 must be at least 27 bytes long.
Edit an integer number the supplied buffer must be at least 27 bytes long .
/*
    * Replacement for sprintf(buf, "%" llu, val)
    */ /* edit backward */