Fix for #4553
[oweals/gnunet.git] / src / fs / fs_getopt.c
index d7ff97c6b7c20c075f422ca3869373cbc8fb1644..46a35e16a5d312e0c3f78d26faaed0f5cde21a99 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -53,7 +53,7 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
 
   if (u == NULL)
   {
-    u = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
+    u = GNUNET_new (struct GNUNET_FS_Uri);
     *uri = u;
     u->type = GNUNET_FS_URI_KSK;
     u->data.ksk.keywordCount = 0;
@@ -118,17 +118,20 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
  * @param scls must be of type "struct GNUNET_MetaData **"
  * @param option name of the option (typically 'k')
  * @param value command line argument given
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 int
-GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
-                               *ctx, void *scls, const char *option,
+GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
+                               void *scls,
+                               const char *option,
                                const char *value)
 {
   struct GNUNET_CONTAINER_MetaData **mm = scls;
+#if HAVE_EXTRACTOR_H
   enum EXTRACTOR_MetaType type;
   const char *typename;
   const char *typename_i18n;
+#endif
   struct GNUNET_CONTAINER_MetaData *meta;
   char *tmp;
 
@@ -144,7 +147,7 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
    */
   /*tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), locale_charset ());*/
   tmp = GNUNET_strdup (value);
-
+#if HAVE_EXTRACTOR_H
   type = EXTRACTOR_metatype_get_max ();
   while (type > 0)
   {
@@ -181,7 +184,9 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext
       break;
     }
   }
-  if (tmp != NULL)
+#endif
+
+  if (NULL != tmp)
   {
     GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
                                        EXTRACTOR_METATYPE_UNKNOWN,