pike.git / src / post_modules / Nettle / hash.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:1:   /* hash.cmod -*- c -*- */      #include "global.h" - RCSID("$Id: hash.cmod,v 1.23 2004/04/30 20:19:53 nilsson Exp $"); + RCSID("$Id: hash.cmod,v 1.24 2004/05/19 00:03:52 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "threads.h"      /* For this_object() */   #include "object.h"   #include "module_support.h"      #include "nettle_config.h"   
pike.git/src/post_modules/Nettle/hash.cmod:111:    struct pike_string *out;    unsigned digest_length;    const struct nettle_hash *meta = THIS->meta;       if (!meta)    Pike_error("HashInfo not properly initialized.\n");    NO_WIDE_STRING(in);       ctx = (void *)alloca(meta->context_size);    if(!ctx) -  Pike_error("Out of memory or karma.\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("hash", meta->context_size);       THREADS_ALLOW();    meta->init(ctx);    meta->update(ctx, in->len, in->str);       digest_length = meta->digest_size;    out = begin_shared_string(digest_length);    meta->digest(ctx, digest_length, out->str);    THREADS_DISALLOW();   
pike.git/src/post_modules/Nettle/hash.cmod:182:    pop_stack();       if (fd_fstat(fd, &st)<0)    Pike_error("File not found!\n");       if (!S_ISREG(st.st_mode))    Pike_error("Non-regular file.\n");       ctx = (void *)alloca(meta->context_size);    if (!ctx) -  Pike_error("Out of memory.\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("hash", meta->context_size);       read_buffer=(char *)malloc(8192);    if (!read_buffer) -  Pike_error("Out of memory.\n"); +  SIMPLE_OUT_OF_MEMORY_ERROR("hash", 8192);       THREADS_ALLOW();    meta->init(ctx);    if(args==2 && bytes->u.integer>-1) {    int bytes_left = bytes->u.integer;    int read_bytes = MINIMUM(8192, bytes_left);    while(read_bytes>0 && (len=fd_read(fd, read_buffer, read_bytes))>0) {    meta->update(ctx, len, read_buffer);    bytes_left -= read_bytes;    read_bytes = MINIMUM(8192, bytes_left);