[70472] branches/gsoc10-configfiles/base/src/registry2.0/entryobj.c
and.damore at macports.org
and.damore at macports.org
Tue Aug 10 09:51:50 PDT 2010
Revision: 70472
http://trac.macports.org/changeset/70472
Author: and.damore at macports.org
Date: 2010-08-10 09:51:49 -0700 (Tue, 10 Aug 2010)
Log Message:
-----------
registry:entry files_with_md5 and imagefiles_with_md5 command, atm these are broken
Modified Paths:
--------------
branches/gsoc10-configfiles/base/src/registry2.0/entryobj.c
Modified: branches/gsoc10-configfiles/base/src/registry2.0/entryobj.c
===================================================================
--- branches/gsoc10-configfiles/base/src/registry2.0/entryobj.c 2010-08-10 14:40:14 UTC (rev 70471)
+++ branches/gsoc10-configfiles/base/src/registry2.0/entryobj.c 2010-08-10 16:51:49 UTC (rev 70472)
@@ -277,16 +277,24 @@
} else {
char** files;
char** md5sums;
+ char** mixed;
reg_error error;
- /* call to entry.c function */
int file_count = reg_entry_files_with_md5(entry, &files, &md5sums, &error);
int i;
if (file_count >= 0) {
Tcl_Obj** objs;
int retval = TCL_ERROR;
- if (list_string_to_obj(&objs, files, file_count, &error)) {
- Tcl_Obj* result = Tcl_NewListObj(file_count, objs);
- /* sending the result to Tcl, an object in this case */
+
+ mixed=malloc(2*file_count*sizeof(char *));
+ for (i=0; i<2*file_count; i+=2) {
+ /* could Tcl_* functions instead, Tcl_NewListObj and then
+ Tcl_ListObjAppendElement on Tcl_NewString() files[i] md5sums[i]
+ */
+ mixed[i+0]=files[i];
+ mixed[i+1]=md5sums[i];
+ }
+ if (list_string_to_obj(&objs, mixed, 2*file_count, &error)) {
+ Tcl_Obj* result = Tcl_NewListObj(2*file_count, objs);
Tcl_SetObjResult(interp, result);
free(objs);
retval = TCL_OK;
@@ -295,8 +303,11 @@
}
for (i=0; i<file_count; i++) {
free(files[i]);
+ free(md5sums[i]);
}
free(files);
+ free(md5sums);
+ free(mixed);
return retval;
}
return registry_failed(interp, &error);
@@ -348,14 +359,23 @@
} else {
char** files;
char** md5sums;
+ char** mixed;
reg_error error;
int file_count = reg_entry_imagefiles_with_md5(entry, &files, &md5sums, &error);
int i;
if (file_count >= 0) {
Tcl_Obj** objs;
int retval = TCL_ERROR;
- if (list_string_to_obj(&objs, files, file_count, &error)) {
- Tcl_Obj* result = Tcl_NewListObj(file_count, objs);
+ mixed=malloc(2*file_count*sizeof(char *));
+ for (i=0; i<2*file_count; i+=2) {
+ /* could Tcl_* functions instead, Tcl_NewListObj and then
+ Tcl_ListObjAppendElement on Tcl_NewString() files[i] md5sums[i]
+ */
+ mixed[i+0]=files[i];
+ mixed[i+1]=md5sums[i];
+ }
+ if (list_string_to_obj(&objs, mixed, 2*file_count, &error)) {
+ Tcl_Obj* result = Tcl_NewListObj(2*file_count, objs);
Tcl_SetObjResult(interp, result);
free(objs);
retval = TCL_OK;
@@ -364,8 +384,11 @@
}
for (i=0; i<file_count; i++) {
free(files[i]);
+ free(md5sums[i]);
}
free(files);
+ free(md5sums);
+ free(mixed);
return retval;
}
return registry_failed(interp, &error);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100810/30a38370/attachment.html>
More information about the macports-changes
mailing list