Author: hbelusca
Date: Fri Jan 23 21:38:15 2015
New Revision: 66080
URL:
http://svn.reactos.org/svn/reactos?rev=66080&view=rev
Log:
[CDMAKE]
- llmosrt.c --> llmsort.c as it should be named.
- Remove useless free(...) calls and a temp variable.
Added:
trunk/reactos/tools/cdmake/llmsort.c
- copied unchanged from r66079, trunk/reactos/tools/cdmake/llmosrt.c
Removed:
trunk/reactos/tools/cdmake/llmosrt.c
Modified:
trunk/reactos/tools/cdmake/CMakeLists.txt
trunk/reactos/tools/cdmake/cdmake.c
trunk/reactos/tools/cdmake/dirhash.c
Modified: trunk/reactos/tools/cdmake/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/CMakeLists.tx…
==============================================================================
--- trunk/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/CMakeLists.txt [iso-8859-1] Fri Jan 23 21:38:15 2015
@@ -1,2 +1,2 @@
-add_executable(cdmake cdmake.c dirhash.c llmosrt.c)
+add_executable(cdmake cdmake.c dirhash.c llmsort.c)
Modified: trunk/reactos/tools/cdmake/cdmake.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
==============================================================================
--- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Fri Jan 23 21:38:15 2015
@@ -653,7 +653,7 @@
{
PDIR_RECORD d;
- d = calloc(1, sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(*d));
if (d == NULL)
error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory;
@@ -687,7 +687,7 @@
char *n;
*/
- d = calloc(1, sizeof(DIR_RECORD));
+ d = calloc(1, sizeof(*d));
if (d == NULL)
error_exit("Insufficient memory");
d->next_in_memory = root.next_in_memory;
Modified: trunk/reactos/tools/cdmake/dirhash.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/dirhash.c?rev…
==============================================================================
--- trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/dirhash.c [iso-8859-1] Fri Jan 23 21:38:15 2015
@@ -39,7 +39,6 @@
last_slash = strrchr(name, '\\');
if (!last_slash)
{
- free(*dirname);
*dirname = malloc(1);
**dirname = 0;
}
@@ -48,7 +47,6 @@
char *newdata = malloc(last_slash - name + 1);
memcpy(newdata, name, last_slash - name);
newdata[last_slash - name] = 0;
- free(*dirname);
*dirname = newdata;
}
}
@@ -157,7 +155,6 @@
{
struct target_file *tf;
struct target_dir_entry *de;
- const char *filename = chop_filename(target);
char *targetdir = NULL;
char *targetnorm;
chop_dirname(target, &targetdir);
@@ -170,7 +167,7 @@
tf->next = de->head;
de->head = tf;
tf->source_name = strdup(source);
- tf->target_name = strdup(filename);
+ tf->target_name = strdup(chop_filename(target));
}
static struct target_dir_entry *
Removed: trunk/reactos/tools/cdmake/llmosrt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/llmosrt.c?rev…
==============================================================================
--- trunk/reactos/tools/cdmake/llmosrt.c [iso-8859-1] (original)
+++ trunk/reactos/tools/cdmake/llmosrt.c (removed)
@@ -1,105 +0,0 @@
-/* A Linked-List Memory Sort
- by Philip J. Erdelsky
- pje(a)acm.org
-
http://www.alumni.caltech.edu/~pje/
-*/
-
-/* According to his website, this file was released into the public domain by Phillip J.
Erdelsky */
-
-
-#include <stdio.h>
-
-void *sort_linked_list(void *p, unsigned index, int (*compare)(void *, void *))
-{
- unsigned base;
- unsigned long block_size;
-
- struct record
- {
- struct record *next[1];
- /* other members not directly accessed by this function */
- };
-
- struct tape
- {
- struct record *first, *last;
- unsigned long count;
- } tape[4];
-
- /* Distribute the records alternately to tape[0] and tape[1]. */
-
- tape[0].count = tape[1].count = 0L;
- tape[0].first = NULL;
- base = 0;
- while (p != NULL)
- {
- struct record *next = ((struct record *)p)->next[index];
- ((struct record *)p)->next[index] = tape[base].first;
- tape[base].first = ((struct record *)p);
- tape[base].count++;
- p = next;
- base ^= 1;
- }
-
- /* If the list is empty or contains only a single record, then */
- /* tape[1].count == 0L and this part is vacuous. */
-
- for (base = 0, block_size = 1L; tape[base+1].count != 0L;
- base ^= 2, block_size <<= 1)
- {
- int dest;
- struct tape *tape0, *tape1;
- tape0 = tape + base;
- tape1 = tape + base + 1;
- dest = base ^ 2;
- tape[dest].count = tape[dest+1].count = 0;
- for (; tape0->count != 0; dest ^= 1)
- {
- unsigned long n0, n1;
- struct tape *output_tape = tape + dest;
- n0 = n1 = block_size;
- while (1)
- {
- struct record *chosen_record;
- struct tape *chosen_tape;
- if (n0 == 0 || tape0->count == 0)
- {
- if (n1 == 0 || tape1->count == 0)
- break;
- chosen_tape = tape1;
- n1--;
- }
- else if (n1 == 0 || tape1->count == 0)
- {
- chosen_tape = tape0;
- n0--;
- }
- else if ((*compare)(tape0->first, tape1->first) > 0)
- {
- chosen_tape = tape1;
- n1--;
- }
- else
- {
- chosen_tape = tape0;
- n0--;
- }
- chosen_tape->count--;
- chosen_record = chosen_tape->first;
- chosen_tape->first = chosen_record->next[index];
- if (output_tape->count == 0)
- output_tape->first = chosen_record;
- else
- output_tape->last->next[index] = chosen_record;
- output_tape->last = chosen_record;
- output_tape->count++;
- }
- }
- }
-
- if (tape[base].count > 1L)
- tape[base].last->next[index] = NULL;
- return tape[base].first;
-}
-
-/* EOF */