summaryrefslogtreecommitdiff
path: root/src/libstddjb/stralloc_reverse.c
blob: 9ad29e78c0f748245a6eac7599fe715047a245be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* ISC license. */

#include <skalibs/bytestr.h>
#include <skalibs/stralloc.h>

void stralloc_reverse (stralloc *sa)
{
  register unsigned int i = 0 ;
  for (; i < sa->len >> 1 ; i++)
  {
    char tmp = sa->s[i] ;
    sa->s[i] = sa->s[sa->len - 1 - i] ;
    sa->s[sa->len - 1 - i] = tmp ;
  }
}