You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
330 B
C
17 lines
330 B
C
#include "byte.h"
|
|
#include "buffer.h"
|
|
|
|
int buffer_putalign(buffer* b,const char* buf,unsigned int len) {
|
|
int tmp;
|
|
while (len>(tmp=b->a-b->p)) {
|
|
byte_copy(b->x+b->p, tmp, buf);
|
|
b->p+=tmp;
|
|
buf+=tmp;
|
|
len-=tmp;
|
|
if (buffer_flush(b)<0) return -1;
|
|
}
|
|
byte_copy(b->x+b->p, len, buf);
|
|
b->p+=len;
|
|
return 0;
|
|
}
|