Пример #1
0
void cache_object_add_compressed_file(struct cache_object *co, FILE *f)
{
    size_t len = file_length(f);
    struct strbuf buf = STRBUF_INIT;
    struct strbuf dest = STRBUF_INIT;

    if (strbuf_fread(&buf, len, f) < len)
        die("unable to read file\n");
    __compress__(&buf, &dest, 9);
    cache_object_add(co, &dest);
    strbuf_release(&buf);
    strbuf_release(&dest);
}
Пример #2
0
int compress_default(struct strbuf *src, struct strbuf *dest)
{
    return __compress__(src, dest, 9);
}