Check-in [0fb3b3b582]
Overview
Comment:Updated to use Tcl allocation routines for memory allocating/releasing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0fb3b3b582bce90b77b493576b32e7fff4b1c02a
User & Date: rkeene on 2016-11-10 21:14:04
Other Links: manifest | tags
Context
2016-12-09
04:18
Updated to support partial decryption of data check-in: a400fc4409 user: rkeene tags: trunk
2016-11-10
21:14
Updated to use Tcl allocation routines for memory allocating/releasing check-in: 0fb3b3b582 user: rkeene tags: trunk
20:40
Updated to enable use of stubs with dir2c C-VFS builder check-in: fa78eca529 user: rkeene tags: trunk
Changes

Modified kitsh/buildsrc/kitsh-0.0/cvfs_data.c from [010e908a77] to [184ea3e79a].

   270    270   		Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC);
   271    271   
   272    272   		return(TCL_ERROR);
   273    273   	}
   274    274   
   275    275   	Tcl_IncrRefCount(ret_list);
   276    276   
   277         -	children = malloc(sizeof(*children) * num_children);
          277  +	children = (void *) Tcl_Alloc(sizeof(*children) * num_children);
   278    278   
   279    279   	num_children = cmd_getChildren(file, children, num_children);
   280    280   
   281    281   	for (idx = 0; idx < num_children; idx++) {
   282    282   		finfo = cmd_getData(NULL, children[idx]);
   283    283   
   284    284   		if (finfo == NULL || finfo->name == NULL) {
................................................................................
   292    292   		Tcl_IncrRefCount(ret_curr_obj);
   293    293   
   294    294   		Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj);
   295    295   
   296    296   		Tcl_DecrRefCount(ret_curr_obj);
   297    297   	}
   298    298   
   299         -	free(children);
          299  +	Tcl_Free((void *) children);
   300    300   
   301    301   	Tcl_SetObjResult(interp, ret_list);
   302    302   
   303    303   	Tcl_DecrRefCount(ret_list);
   304    304   
   305    305   	return(TCL_OK);
   306    306   }

Modified kitsh/buildsrc/kitsh-0.0/dir2c.tcl from [dff14cac78] to [74a40bc096].

   233    233   #  endif
   234    234   #  ifdef HAVE_STRING_H
   235    235   #    include <string.h>
   236    236   #  endif
   237    237   #  ifdef HAVE_STDLIB_H
   238    238   #    include <stdlib.h>
   239    239   #  endif
          240  +#  include <tcl.h>
   240    241   
   241    242   #  ifndef LOADED_CVFS_COMMON
   242    243   #    define LOADED_CVFS_COMMON 1
   243    244   
   244    245   typedef enum {
   245    246   	CVFS_FILETYPE_FILE            = 0,
   246    247   	CVFS_FILETYPE_DIR             = 1,
................................................................................
   508    509   
   509    510   if {$obsfucate} {
   510    511   	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
   511    512   	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
   512    513   	puts "\tunsigned char *new_data, *old_data;"
   513    514   	puts "\tint decrypt_ret, free_old_data;"
   514    515   	puts ""
   515         -	puts "\tnew_data = malloc(finfo->size);"
          516  +	puts "\tnew_data = (void *) Tcl_Alloc(finfo->size);"
   516    517   	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
   517    518   	puts "\tif (decrypt_ret != 0) {"
   518         -	puts "\t\tfree(new_data);"
          519  +	puts "\t\tTcl_Free((void *) new_data);"
   519    520   	puts ""
   520    521   	puts "\t\treturn;"
   521    522   	puts "\t}"
   522    523   	puts ""
   523    524   	puts "\tfree_old_data = finfo->free;"
   524    525   	puts "\told_data = (void *) finfo->data;"
   525    526   	puts ""
   526    527   	puts "\tfinfo->data = new_data;"
   527    528   	puts "\tfinfo->free = 1;"
   528    529   	puts "\tfinfo->type = CVFS_FILETYPE_FILE;"
   529    530   	puts ""
   530    531   	puts "\tif (free_old_data) {"
   531         -	puts "\t\tfree(old_data);"
          532  +	puts "\t\tTcl_Free((void *) old_data);"
   532    533   	puts "\t}"
   533    534   	puts "\treturn;"
   534    535   	puts "}"
   535    536   	puts ""
   536    537   }
   537    538   
   538    539   puts "#  ifdef CVFS_MAKE_LOADABLE"