[PD-cvs] pd/src kernel.c,1.1.2.73,1.1.2.74

Mathieu Bouchard matju at users.sourceforge.net
Mon Jul 30 22:11:24 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16701

Modified Files:
      Tag: desiredata
	kernel.c 
Log Message:
some more t_hash changes


Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.73
retrieving revision 1.1.2.74
diff -C2 -d -r1.1.2.73 -r1.1.2.74
*** kernel.c	30 Jul 2007 19:56:29 -0000	1.1.2.73
--- kernel.c	30 Jul 2007 20:11:22 -0000	1.1.2.74
***************
*** 1,3 ****
! /* Copyright 2006-2007 Mathieu Bouchard.
   * Copyright (c) 1997-2006 Miller Puckette.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
--- 1,4 ----
! /* $Id$
!  * Copyright 2006-2007 Mathieu Bouchard.
   * Copyright (c) 1997-2006 Miller Puckette.
   * For information on usage and redistribution, and for a DISCLAIMER OF ALL
***************
*** 107,123 ****
  
  t_class *hash_class;
- 
  t_hash::t_hash(long capa_) {
  	capa = capa_;
  	n=0;
  	i=0;
! 	tab = (t_hashentry **)malloc(capa*sizeof(void*));
  	for (long j=0; j<capa; j++) tab[j]=0;
  }
! 
! t_hash::~t_hash() {
! 	free(tab);
! }
! 
  void t_hash::start() {i=0; m_next=0;}
  int  t_hash::next(hashkey *kp, hashvalue *vp) {
--- 108,119 ----
  
  t_class *hash_class;
  t_hash::t_hash(long capa_) {
  	capa = capa_;
  	n=0;
  	i=0;
! 	tab = new t_hashentry *[capa];
  	for (long j=0; j<capa; j++) tab[j]=0;
  }
! t_hash::~t_hash() {delete[] tab;}
  void t_hash::start() {i=0; m_next=0;}
  int  t_hash::next(hashkey *kp, hashvalue *vp) {
***************
*** 131,140 ****
  	return 0;
  }
- 
  long t_hash::hash(hashkey k) {
  	long h = ((long)k*0x54321) & 0x7FFFFFFF;
  	return h%capa;
  }
- 
  int t_hash::exists(hashkey k) {
  	long h = hash(k);
--- 127,134 ----
***************
*** 147,156 ****
  	return 0;
  }
- 
  void t_hash::set(hashkey k, hashvalue v) {
  	long h = hash(k);
  	t_hashentry *nu;
  	for (t_hashentry *e=tab[h]; e; e=e->next) {if (e->k==k) {e->v=v; return;}}
! 	nu = (t_hashentry *)malloc(sizeof(t_hashentry));
  	n++;
  	nu->k=k;
--- 141,149 ----
  	return 0;
  }
  void t_hash::set(hashkey k, hashvalue v) {
  	long h = hash(k);
  	t_hashentry *nu;
  	for (t_hashentry *e=tab[h]; e; e=e->next) {if (e->k==k) {e->v=v; return;}}
! 	nu = new t_hashentry;
  	n++;
  	nu->k=k;
***************
*** 159,163 ****
  	tab[h] = nu;
  }
- 
  hashvalue t_hash::del(hashkey k) {
  	long h = hash(k);
--- 152,155 ----
***************
*** 166,170 ****
  			hashvalue v=(*ep)->v;
  			t_hashentry *next=(*ep)->next;
! 			free(*ep); n--;
  			*ep = next;
  			return v;
--- 158,162 ----
  			hashvalue v=(*ep)->v;
  			t_hashentry *next=(*ep)->next;
! 			delete *ep; n--;
  			*ep = next;
  			return v;





More information about the Pd-cvs mailing list