adding single location for no_forcestart configuration list
[oweals/gnunet.git] / src / fs / fs_file_information.c
index da4e85b783fe68f9fbda373de7758ca39e21bbf8..f004e4b295dc5f02a004dfc2f46e34819f3a8eef 100644 (file)
@@ -116,14 +116,14 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
   char fn_conv[MAX_PATH];
 #endif
 
-  /* FIXME: should includeSymLinks be GNUNET_NO or GNUNET_YES here? */
+  /* FIXME: should include_symbolic_links be GNUNET_NO or GNUNET_YES here? */
   if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fsize, GNUNET_NO, GNUNET_YES))
   {
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "stat", filename);
     return NULL;
   }
   fi = GNUNET_FS_make_file_reader_context_ (filename);
-  if (fi == NULL)
+  if (NULL == fi)
   {
     GNUNET_break (0);
     return NULL;
@@ -241,7 +241,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h,
     GNUNET_break (0);
     return NULL;
   }
-  ret = GNUNET_malloc (sizeof (struct GNUNET_FS_FileInformation));
+  ret = GNUNET_new (struct GNUNET_FS_FileInformation);
   ret->h = h;
   ret->client_info = client_info;
   ret->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
@@ -261,7 +261,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h,
  * Test if a given entry represents a directory.
  *
  * @param ent check if this FI represents a directory
- * @return GNUNET_YES if so, GNUNET_NO if not
+ * @return #GNUNET_YES if so, #GNUNET_NO if not
  */
 int
 GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation
@@ -273,9 +273,6 @@ GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation
 
 /**
  * Create an entry for an empty directory in a publish-structure.
- * This function should be used by applications for which the
- * use of "GNUNET_FS_file_information_create_from_directory"
- * is not appropriate.
  *
  * @param h handle to the file sharing subsystem
  * @param client_info initial value for the client-info value for this entry
@@ -300,7 +297,7 @@ GNUNET_FS_file_information_create_empty_directory (struct GNUNET_FS_Handle *h,
 {
   struct GNUNET_FS_FileInformation *ret;
 
-  ret = GNUNET_malloc (sizeof (struct GNUNET_FS_FileInformation));
+  ret = GNUNET_new (struct GNUNET_FS_FileInformation);
   ret->h = h;
   ret->client_info = client_info;
   ret->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
@@ -409,7 +406,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
   int no;
 
   no = GNUNET_NO;
-  if (fi->is_directory == GNUNET_YES)
+  if (GNUNET_YES == fi->is_directory)
   {
     /* clean up directory */
     while (NULL != (pos = fi->data.dir.entries))
@@ -439,7 +436,10 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
   }
   GNUNET_free_non_null (fi->filename);
   GNUNET_free_non_null (fi->emsg);
-  GNUNET_free_non_null (fi->chk_uri);
+  if (NULL != fi->sks_uri)
+      GNUNET_FS_uri_destroy (fi->sks_uri);
+  if (NULL != fi->chk_uri)
+      GNUNET_FS_uri_destroy (fi->chk_uri);
   /* clean up serialization */
   if ((NULL != fi->serialization) && (0 != UNLINK (fi->serialization)))
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink",
@@ -451,7 +451,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
   GNUNET_free_non_null (fi->serialization);
   if (NULL != fi->te)
   {
-    GNUNET_FS_tree_encoder_finish (fi->te, NULL, NULL);
+    GNUNET_FS_tree_encoder_finish (fi->te, NULL);
     fi->te = NULL;
   }
   GNUNET_free (fi);