Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a790875c25
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (34 sloc) 0.731 kb
/*
* Copyright (c) 2000-2004,2005 by Inlab Software GmbH, Gruenwald, Germany.
* All rights reserved.
*
*/
/*
* $Id: butils.c,v 1.1 2010/01/29 10:40:16 t Exp $
*/
#include <balance.h>
char* butils_rcsid="$Id: butils.c,v 1.1 2010/01/29 10:40:16 t Exp $";
unsigned int hash_fold(char* s, int len)
{
unsigned int rc = 0;
int i;
for (i=0; i<len; i++) {
rc = s[i] + 31 * rc;
}
return(rc);
}
ssize_t writen(int fd, unsigned char *ptr, size_t nbytes)
{
int nleft;
ssize_t nwritten;
nleft = nbytes;
while (nleft > 0) {
nwritten = write(fd, ptr, nleft);
if (nwritten <= 0) {
return (nwritten); /* error */
}
nleft -= nwritten;
ptr += nwritten;
}
return (nbytes - nleft);
}
Jump to Line
Something went wrong with that request. Please try again.