jim

Simple, lightweight, modal, vim-inspired text editor
git clone git://git.janpasierb.com/jim.git
Log | Files | Refs | README | LICENSE

appbuf.c (319B)


      1 #include"appbuf.h"
      2 #include<stdlib.h>
      3 #include<string.h>
      4 
      5 void abAppend(struct abuf* ab, const char* s, int len) {
      6     char* new = realloc(ab->b, ab->len + len);
      7 
      8     if(new == NULL) 
      9 		return;
     10     memcpy(&new[ab->len], s, len);
     11     ab->b = new;
     12     ab->len += len;
     13 }
     14 
     15 void abFree(struct abuf* ab) {
     16     free(ab->b);
     17 }