comparison buffer.c @ 925:bae0b34bc059 pam

Better PAM through recursion
author Matt Johnston <matt@ucc.asn.au>
date Wed, 12 Mar 2014 23:40:02 +0800
parents 7dcb46da72d9
children 2fa71c3b2827
comparison
equal deleted inserted replaced
923:25b7ed9fe854 925:bae0b34bc059
178 } 178 }
179 buf->data[buf->pos] = val; 179 buf->data[buf->pos] = val;
180 buf->pos++; 180 buf->pos++;
181 } 181 }
182 182
183 void buf_putbool(buffer* buf, unsigned int val) {
184 char truth = val ? 1 : 0;
185 buf_putbyte(buf, truth);
186 }
187
183 /* returns an in-place pointer to the buffer, checking that 188 /* returns an in-place pointer to the buffer, checking that
184 * the next len bytes from that position can be used */ 189 * the next len bytes from that position can be used */
185 unsigned char* buf_getptr(buffer* buf, unsigned int len) { 190 unsigned char* buf_getptr(buffer* buf, unsigned int len) {
186 191
187 if (buf->pos + len > buf->len) { 192 if (buf->pos + len > buf->len) {