Repositories » libk0
Clone URL:  
Pushed to one repository · View In Graph Contained in v0.1 and tip

cleanup

Changeset 7f13c12583ab

Parent 70f508a011fe

by Rup Palchowdhury

Changes to 3 files · Browse files at 7f13c12583ab Showing diff from parent 70f508a011fe Diff from another changeset...

Change 1 of 2 Show Entire File kpost.c Stacked
 
3
4
5
6
 
7
8
9
 
18
19
20
 
 
 
 
 
 
21
22
23
 
3
4
5
 
6
7
8
9
 
18
19
20
21
22
23
24
25
26
27
28
29
@@ -3,7 +3,7 @@
 #include <string.h>  #include "kpost.h"   -Post *newpost(char *s, float f) +Post *newpost(char *s, int f)  {   Post *t;   t = (Post *)malloc(sizeof(Post)); @@ -18,6 +18,12 @@
  return strcmp(((Post *)t)->s, ((Post *)t1)->s);  }   +int post_match_handler(void *t, void *t1) +{ + ((Post *)t)->f += ((Post *)t1)->f; + return 1; +} +  void freepost(void *t)  {   Post *t_;
Change 1 of 1 Show Entire File kpost.h Stacked
 
2
3
4
5
 
6
7
8
 
9
 
10
11
12
 
2
3
4
 
5
6
7
 
8
9
10
11
12
13
@@ -2,11 +2,12 @@
   struct Post {   char *s; - float f; + int f;  };   -Post *newpost(char*, float); +Post *newpost(char*, int);  int postcmp(void*, void*); +int post_match_handler(void*, void*);  void freepost(void*);  void printpost(void*, void*);  unsigned int hashpost(unsigned int (*fn)(char*, int), void*, int);
Change 1 of 1 Show Entire File ktree.c Stacked
 
29
30
31
32
 
33
34
35
 
29
30
31
 
32
33
34
35
@@ -29,7 +29,7 @@
  cmp = (*tnodecmp)(n->data, p->data);   if (cmp == 0) {   if (match_handler != NULL) - (*match_handler)(n->data, p->data); + (*match_handler)(p->data, n->data);   }   else if (cmp < 0)   p->l = insert(p->l, n, tnodecmp, match_handler);