skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

stralloc_reverse.c (271B)


      1 /* ISC license. */
      2 
      3 #include <string.h>
      4 #include <skalibs/stralloc.h>
      5 
      6 void stralloc_reverse (stralloc *sa)
      7 {
      8   size_t i = 0 ;
      9   for (; i < sa->len >> 1 ; i++)
     10   {
     11     char tmp = sa->s[i] ;
     12     sa->s[i] = sa->s[sa->len - 1 - i] ;
     13     sa->s[sa->len - 1 - i] = tmp ;
     14   }
     15 }