Differences From Artifact [7f07dd8ac4]:
- File
src/stream.c
— part of check-in
[2cee5ea2d5]
at
2012-09-30 01:01:37
on branch trunk
— Add cfw_stream_read_line().
This also adds a caching infrastructure to cfw_stream. (user: js, size: 6336) [annotate] [blame] [check-ins using]
To Artifact [c9268ffce9]:
- File src/stream.c — part of check-in [168ba16eda] at 2012-09-30 01:02:03 on branch trunk — Add cfw_stream_write_line(). (user: js, size: 6667) [annotate] [blame] [check-ins using]
︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | + + + + + + + + + + + + + + + + + + + + + + + + | } bool cfw_stream_write_string(void *ptr, const char *str) { return cfw_stream_write(ptr, str, strlen(str)); } bool cfw_stream_write_line(void *ptr, const char *str) { char *tmp; size_t len; len = strlen(str); if ((tmp = malloc(len + 2)) == NULL) return false; memcpy(tmp, str, len); tmp[len] = '\n'; tmp[len + 1] = '\0'; if (!cfw_stream_write(ptr, tmp, len + 1)) { free(tmp); return false; } free(tmp); return true; } bool cfw_stream_eof(void *ptr) { CFWStream *stream = ptr; if (stream == NULL || stream->ops == NULL) |
︙ |