Public » Mercurial » dirstate
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

sanitize variable naming convention

Changeset 9c8a7f745c1f

Parent 6f548f28defe

by Profile picture of Benjamin PollackBenjamin Pollack

Changes to one file · Browse files at 9c8a7f745c1f Showing diff from parent 6f548f28defe Diff from another changeset...

Change 1 of 4 Show Entire File dirstate.c Stacked
 
32
33
34
35
 
36
37
 
38
39
40
 
 
41
42
 
43
44
45
 
47
48
49
50
51
52
 
 
 
53
54
55
 
60
61
62
63
 
64
65
66
 
67
68
69
 
70
71
72
73
74
 
 
 
75
76
77
 
90
91
92
93
 
94
95
96
97
98
 
 
 
 
99
100
 
101
102
 
103
104
 
32
33
34
 
35
36
 
37
38
 
 
39
40
41
 
42
43
44
45
 
47
48
49
 
 
 
50
51
52
53
54
55
 
60
61
62
 
63
64
65
 
66
67
68
 
69
70
71
 
 
 
72
73
74
75
76
77
 
90
91
92
 
93
94
 
 
 
 
95
96
97
98
99
 
100
101
 
102
103
104
@@ -32,14 +32,14 @@
  return p;  }   -void dirstate_add_entry(dirstate *d, const direntry *e) +void dirstate_add_entry(dirstate *pd, const direntry *pe)  { - if (d->num_entries == d->__entries_length) + if (pd->num_entries == pd->__entries_length)   { - d->__entries_length = d->__entries_length ? 2 * d->__entries_length : 1; - d->entries = realloc(d->entries, d->__entries_length * sizeof(direntry)); + pd->__entries_length = pd->__entries_length ? 2 * pd->__entries_length : 1; + pd->entries = realloc(pd->entries, pd->__entries_length * sizeof(direntry));   } - d->entries[d->num_entries++] = *e; + pd->entries[pd->num_entries++] = *pe;  }    dirstate *dirstate_new(const char *path) @@ -47,9 +47,9 @@
  direntry e;   FILE *f = fopen(path, "r");   if (!f) return NULL; - dirstate *d = xalloc(1, sizeof(dirstate)); - fread(&d->parent1, sizeof(char), HASH_LENGTH, f); - fread(&d->parent2, sizeof(char), HASH_LENGTH, f); + dirstate *pd = xalloc(1, sizeof(dirstate)); + fread(&pd->parent1, sizeof(char), HASH_LENGTH, f); + fread(&pd->parent2, sizeof(char), HASH_LENGTH, f);     while (fread(&e.state, sizeof(e.state), 1, f) == 1)   { @@ -60,18 +60,18 @@
  e.name = malloc(e.length * sizeof(char) + 1);   fread(e.name, sizeof(char), e.length, f);   e.name[e.length] = 0; - dirstate_add_entry(d, &e); + dirstate_add_entry(pd, &e);   }   - return d; + return pd;  }   -void dirstate_free(dirstate *d) +void dirstate_free(dirstate *pd)  {   unsigned ix; - for (ix = 0; ix < d->num_entries; ++ix) free(d->entries[ix].name); - free(d->entries); - free(d); + for (ix = 0; ix < pd->num_entries; ++ix) free(pd->entries[ix].name); + free(pd->entries); + free(pd);  }    static char *rev_string(const char revhash[HASH_LENGTH]) @@ -90,15 +90,15 @@
   int main(int argc, char *argv[])  { - dirstate *d = dirstate_new(".hg/dirstate"); + dirstate *pd = dirstate_new(".hg/dirstate");   unsigned ix; - printf("parent1: %s\n", rev_string(d->parent1)); - printf("parent2: %s\n", rev_string(d->parent2)); - printf("entries: %d\n", d->num_entries); - for (ix = 0; ix < d->num_entries; ++ix) + printf("parent1: %s\n", rev_string(pd->parent1)); + printf("parent2: %s\n", rev_string(pd->parent2)); + printf("entries: %d\n", pd->num_entries); + for (ix = 0; ix < pd->num_entries; ++ix)   { - printf("entry: %s\n", d->entries[ix].name); + printf("entry: %s\n", pd->entries[ix].name);   } - dirstate_free(d); + dirstate_free(pd);   return 0;  }