コード例 #1
0
ファイル: world.c プロジェクト: carriercomm/wmud
void
wmud_world_free_exits(GSList *exits)
{
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Freeing exits list");

    if (exits) {
#if GLIB_CHECK_VERSION(2, 28, 0)
        g_slist_free_full(exits, (GDestroyNotify)g_free);
#else
        g_slist_foreach(exits, (GFunc)g_free, NULL);
        g_slist_free(exits);
#endif
    }
}
コード例 #2
0
ファイル: world.c プロジェクト: carriercomm/wmud
void
wmud_world_free_planet_planes(GSList *planet_planes)
{
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Freeing planet <-> plane associations list");

    if (planet_planes) {
#if GLIB_CHECK_VERSION(2, 28, 0)
        g_slist_free_full(planet_planes, (GDestroyNotify)g_free);
#else
        g_slist_foreach(planet_planes, (GFunc)g_free, NULL);
        g_slist_free(planet_planes);
#endif
    }
}
コード例 #3
0
ファイル: world.c プロジェクト: carriercomm/wmud
void
wmud_world_free_areas(GSList *areas)
{
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Freeing areas list");

    if (areas) {
#if GLIB_CHECK_VERSION(2, 28, 0)
        g_slist_free_full(areas, (GDestroyNotify)free_area);
#else
        g_slist_foreach(areas, (GFunc)free_area, NULL);
        g_slist_free(areas);
#endif
    }
}
コード例 #4
0
ファイル: world.c プロジェクト: carriercomm/wmud
void
wmud_world_free_rooms(GSList *rooms)
{
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Freeing rooms list");

    if (rooms) {
#if GLIB_CHECK_VERSION(2, 28, 0)
        g_slist_free_full(rooms, (GDestroyNotify)free_room);
#else
        g_slist_foreach(rooms, (GFunc)free_room, NULL);
        g_slist_free(rooms);
#endif
    }
}
コード例 #5
0
/**
 * Runs this model.
 *
 * @param self the model.
 * @param herds a herd list.
 * @param zones a zone list.
 * @param event the event that caused the model to run.
 * @param rng a random number generator.
 * @param queue for any new events the model creates.
 */
void
run (struct naadsm_model_t_ *self, HRD_herd_list_t * herds,
     ZON_zone_list_t * zones, EVT_event_t * event, RAN_gen_t * rng, EVT_event_queue_t * queue)
{
#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- ENTER run (%s)", MODEL_NAME);
#endif

  switch (event->type)
    {
    case EVT_TraceResult:
      handle_trace_result_event (self, &(event->u.trace_result), queue);
      break;
    default:
      g_error
        ("%s has received a %s event, which it does not listen for.  This should never happen.  Please contact the developer.",
         MODEL_NAME, EVT_event_type_name[event->type]);
    }

#if DEBUG
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- EXIT run (%s)", MODEL_NAME);
#endif
}
コード例 #6
0
ファイル: world.c プロジェクト: carriercomm/wmud
void
wmud_world_free_directions(GSList *directions)
{
    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Freeing direction list");

    if (directions) {
#if GLIB_CHECK_VERSION(2, 28, 0)
        g_slist_free_full(directions, (GDestroyNotify)free_direction);
#else
        g_slist_foreach(directions, (GFunc)free_direction, NULL);
        g_slist_free(directions);
#endif
    }
}
コード例 #7
0
static void
g_relation_print_index (gpointer tuple_key,
			gpointer tuple_value,
			gpointer user_data)
{
  GRelation* rel = (GRelation*) user_data;
  GHashTable* table = (GHashTable*) tuple_value;
  
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "*** key %p", tuple_key);
  
  g_hash_table_foreach (table,
			g_relation_print_one,
			rel);
}
コード例 #8
0
ファイル: capture.c プロジェクト: PaulCharlton/wireshark
/* Capture child told us that an error has occurred while parsing a
   capture filter when starting/running the capture.
 */
void
capture_input_cfilter_error_message(capture_session *cap_session, guint i,
                                    char *error_message)
{
  capture_options *capture_opts = cap_session->capture_opts;
  dfilter_t *rfcode = NULL;
  gchar *safe_cfilter;
  gchar *safe_descr;
  gchar *safe_cfilter_error_msg;
  interface_options interface_opts;

  g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture filter error message from child: \"%s\"", error_message);

  g_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING);
  g_assert(i < capture_opts->ifaces->len);

  interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
  safe_cfilter = simple_dialog_format_message(interface_opts.cfilter);
  safe_descr = simple_dialog_format_message(interface_opts.descr);
  safe_cfilter_error_msg = simple_dialog_format_message(error_message);
  /* Did the user try a display filter? */
  if (dfilter_compile(interface_opts.cfilter, &rfcode) && rfcode != NULL) {
    simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
      "%sInvalid capture filter \"%s\" for interface %s!%s\n"
      "\n"
      "That string looks like a valid display filter; however, it isn't a valid\n"
      "capture filter (%s).\n"
      "\n"
      "Note that display filters and capture filters don't have the same syntax,\n"
      "so you can't use most display filter expressions as capture filters.\n"
      "\n"
      "See the User's Guide for a description of the capture filter syntax.",
      simple_dialog_primary_start(), safe_cfilter, safe_descr,
      simple_dialog_primary_end(), safe_cfilter_error_msg);
      dfilter_free(rfcode);
  } else {
    simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
      "%sInvalid capture filter \"%s\" for interface %s!%s\n"
      "\n"
      "That string isn't a valid capture filter (%s).\n"
      "See the User's Guide for a description of the capture filter syntax.",
      simple_dialog_primary_start(), safe_cfilter, safe_descr,
      simple_dialog_primary_end(), safe_cfilter_error_msg);
  }
  g_free(safe_cfilter_error_msg);
  g_free(safe_descr);
  g_free(safe_cfilter);

  /* the capture child will close the sync_pipe if required, nothing to do for now */
}
コード例 #9
0
bionet_stream_t *bionet_node_get_stream_by_id(const bionet_node_t *node, const char *stream_id) {
    GSList *i;

    if (node == NULL) {
        g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_node_get_stream_by_id(): NULL Node passed in");
        errno = EINVAL;
        return NULL;
    }

    if (stream_id == NULL) {
        g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_node_get_stream_by_id(): NULL Stream-ID passed in");
        errno = EINVAL;
        return NULL;
    }

    for (i = node->streams; i != NULL; i = i->next) {
        bionet_stream_t *stream = i->data;
        if (strcmp(stream->id, stream_id) == 0) return stream;
    }

    errno = ENOENT;
    return NULL;
}
コード例 #10
0
ファイル: bdm-get-hab.c プロジェクト: SebKuzminsky/hammerhead
bionet_hab_t *bionet_bdm_get_hab_by_name(bionet_bdm_t *bdm, const char *hab_name) {
    int i;


    if (bdm == NULL) {
        g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_bdm_get_hab_by_name(): NULL HAB passed in");
        return NULL;
    }

    if (hab_name == NULL) {
        g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_bdm_get_hab_by_name(): NULL HAB-ID passed in");
        return NULL;
    }

    for (i = 0; i < g_slist_length(bdm->habs); i ++) {
        bionet_hab_t *hab;

        hab = g_slist_nth_data(bdm->habs, i);
        if (strcmp(bionet_hab_get_name(hab), hab_name) == 0) return hab;
    }

    return NULL;
}
コード例 #11
0
ファイル: checkmore.c プロジェクト: community-ssu/mafw
/*
 * This function is called by GLib when g_return_if_fail() detects an
 * error, suppressing its message as long as $CheckMore_expect_fallback.
 * After that it should behave like the original function.
 */
void g_return_if_fail_warning(const char *domain,
			      const char *fun,
			      const char *expr)
{
	if (CheckMore_expect_fallback > 0) {
		/* NOTE If this counter overflows expect_ignore() and
		 * expect_fallback() will complain for no reason. */
		CheckMore_expect_fallback++;
		return;
	}

	g_log(domain, G_LOG_LEVEL_CRITICAL, "%s: assertion `%s' failed",
	      fun, expr);
}
コード例 #12
0
ファイル: fo-object.c プロジェクト: hrs-allbsd/xmlroff
/**
 * fo_object_log_debug_default:
 * @object: #FoObject that is subject of @error.
 * @debug:  #GError with debugging information.
 * 
 * Logs a "debug" message about @error.
 *
 * Clears @error.
 **/
void
fo_object_log_debug_default (FoObject *object,
			     GError  **debug)
{
  g_return_if_fail (object != NULL);
  g_return_if_fail (FO_IS_OBJECT (object));

  g_log (G_LOG_DOMAIN,
	 G_LOG_LEVEL_DEBUG,
	 "Debug: %s: %s",
	 g_quark_to_string ((*debug)->domain),
	 (*debug)->message);
  g_clear_error (debug);
}
コード例 #13
0
struct activity*
tma_activity_update(int id, char* description)
{
	struct activity* a = tma_read(ACTIVITY, id);
	
	if (a != NULL)
	{
		free(a->description);
		a->description = strdup(description);
		g_log("tma", G_LOG_LEVEL_DEBUG, "Updated activity: %p - %s\n", a, a->description);
	}

	return a;
}
コード例 #14
0
void locke_appmanager_scan_for_deploys(LockeAppManager *lam, GFile *deployDir) {
	if (g_file_query_file_type(deployDir, G_FILE_QUERY_INFO_NONE, NULL)
			!= G_FILE_TYPE_DIRECTORY) {
		g_log(LSVR_DOMAIN, G_LOG_LEVEL_WARNING,
				"Hey, autodeploy dir '%s' does not exist!! Create it to be able to make deploys. ",
				g_file_get_path(deployDir));
		return;
	}
	g_log(LSVR_DOMAIN, G_LOG_LEVEL_INFO, "Scanning folder '%s' for application deployments",
			g_file_get_path(deployDir));

	/* Get file enumerator */
	GError *err = NULL;
	GFileEnumerator *files = g_file_enumerate_children(deployDir, "*",
			G_FILE_QUERY_INFO_NONE, NULL, &err);
	if (err != NULL) {
		/* Report error to user, and free error */
		g_log(LSVR_DOMAIN, G_LOG_LEVEL_ERROR, "Unable to get file list for directory '%s': %s",
				g_file_get_path(deployDir), err->message);
		g_error_free(err);
		goto scan_for_deploys_finally;
	}

	/* process each file individually */
	GFileInfo *fileInfo = NULL;
	do {
		fileInfo = g_file_enumerator_next_file(files, NULL, &err);
		if (err != NULL) {
			/* Report error to user, and free error */
			g_log(LSVR_DOMAIN, G_LOG_LEVEL_ERROR,  "Unable to get file for directory '%s': %s",
					g_file_get_path(deployDir), err->message);
			g_error_free(err);
			goto scan_for_deploys_finally;
		}
		/* stop condition */
		if (fileInfo == NULL)
			break;
		/* finally, process the file */
		g_log(LSVR_DOMAIN, G_LOG_LEVEL_INFO, " =========> Processing file '%s'",
				g_file_info_get_display_name(fileInfo));
		locke_appmanager_add_application(lam, g_file_get_path(deployDir),
				g_file_info_get_name(fileInfo));
	} while (TRUE);

	/* Close open things */
	g_file_enumerator_close(files, NULL, &err);
	if (err != NULL) {
		/* Report error to user, and free error */
		g_log(LSVR_DOMAIN, G_LOG_LEVEL_ERROR,
				"Error closing file enumerator for directory '%s': %s",
				g_file_get_path(deployDir), err->message);
		g_error_free(err);
		goto scan_for_deploys_finally;
	}
	/* Free allocated memory  */
	scan_for_deploys_finally: g_object_unref(files);
}
コード例 #15
0
ファイル: spawn_test.c プロジェクト: cdaffara/symbiandump-os2
/* The following test function returns 1 only when the any one of the g_spawn_command_line_sync  *
   tests fails.For pass of all the test the function returns 0.									 */
int g_spawn_command_line_sync_tests()
{
	GError *error = NULL;
	int retVal = 0;
	int exit_status;
	gchar *standard_output, *standard_error;
	
	if(g_spawn_command_line_sync("helloworld.exe 10 11 12",NULL,NULL,&exit_status,&error))
	{
    	if(exit_status != 0)
    	{
    		g_log(NULL,G_LOG_LEVEL_CRITICAL,"Error in file %s: at line %d",__FILE__, __LINE__);
    		retVal = 1;
    	}
   	}
	else
	{
		if(error)
		{
			g_log(NULL,G_LOG_LEVEL_CRITICAL,"file %s: line %d Error Message:%s",__FILE__,	 __LINE__, error->message);
			g_error_free(error);
			error = NULL;
		}
		else
		{
			g_log(NULL,G_LOG_LEVEL_CRITICAL,"Error in file %s: at line %d",__FILE__, __LINE__);
		}
		retVal = 1;
	}
	
	
	if(g_spawn_command_line_sync("helloworld.exe 10 11 12",&standard_output,&standard_error,&exit_status,&error))
	{
    	if(exit_status != 0 || standard_output != NULL || standard_error != NULL)
    	{
    		g_log(NULL,G_LOG_LEVEL_CRITICAL,"Error in file %s: at line %d",__FILE__, __LINE__);
    		retVal = 1;
    	}
   	}
	else
	{
		if(error)
		{
			g_log(NULL,G_LOG_LEVEL_CRITICAL,"file %s: line %d Error Message:%s",__FILE__,	 __LINE__, error->message);
			g_error_free(error);
			error = NULL;
		}
		else
		{
			g_log(NULL,G_LOG_LEVEL_CRITICAL,"Error in file %s: at line %d",__FILE__, __LINE__);
		}
		retVal = 1;
	}
	
	return retVal;
   	
}
コード例 #16
0
ファイル: dioad.c プロジェクト: bert/pcb-fpw
/*!
 * \brief Look up default values for DIOAD footprint.
 *
 * Footprint values can be looked up by placing a question mark "?" in front
 * of the footprint name.\n
 * If the footprint name is recognised known values will be loaded and the
 * entries involved in the GUI will be updated accordingly.\n
 * Currently the following footprints are supported:\n
 * - DIOAD,
 * - .
 *
 * \return \c EXIT_SUCCESS when default values for a footprint were
 * found, \c EXIT_FAILURE when the footprint name was not found.
 */
int
dioad_get_default_footprint_values ()
{
        if (!strcmp (footprint_name, "?DIOAD800W52L600D150"))
        {
                footprint_units = g_strdup ("mm");
                package_body_length = 6.00;
                package_body_width = 1.50;
                package_body_height = 1.50;
                package_is_radial = FALSE;
                number_of_pins = 2;
                number_of_columns = 2;
                number_of_rows = 1;
                pitch_x = 8.00;
                pitch_y = 0.00;
                count_x = 0;
                count_y = 0;
                pad_diameter = 1.50;
                pin_drill_diameter = 0.60;
                pad_length = 0.0;
                pad_width = 0.00;
                pad_shape = g_strdup ("circular pad");
                pad_shapes_type = ROUND;
                thermal = FALSE;
                thermal_length = 0.0;
                thermal_width = 0.0;
                fiducial = FALSE;
                fiducial_pad_diameter = 0.00;
                fiducial_pad_solder_mask_clearance = 0.00;
                silkscreen_package_outline = TRUE;
                silkscreen_length = 0.00;
                silkscreen_width = 0.00;
                silkscreen_line_width = 0.20;
                courtyard = FALSE;
                courtyard_length = 0.00;
                courtyard_width = 0.00;
                courtyard_line_width = 0.05;
                g_free (footprint_name);
                footprint_name = g_strdup ("DIOAD800W52L600D150");
                return (EXIT_SUCCESS);
        }
        else
        {
                g_log ("", G_LOG_LEVEL_WARNING,
                         (_("default values for footprint %s not found.\n")),
                         footprint_name);
                return (EXIT_FAILURE);
        }
}
コード例 #17
0
gpointer
vsimple_dialog(ESD_TYPE_E type, gint btn_mask, const gchar *msg_format, va_list ap)
{

    gchar             *vmessage;
    gchar             *message;
    SimpleDialog      *dlg = NULL;
//    queued_message_t *queued_message;
//    GtkWidget        *win;
//    GdkWindowState state = 0;

    /* Format the message. */
    vmessage = g_strdup_vprintf(msg_format, ap);

    /* convert character encoding from locale to UTF8 (using iconv) */
    message = g_locale_to_utf8(vmessage, -1, NULL, NULL, NULL);
    g_free(vmessage);

    g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: vsimple_dialog t: %d bm: %d m: %s", type, btn_mask, message);


//    if (top_level != NULL) {
//        state = gdk_window_get_state(top_level->window);
//    }

//    /* If we don't yet have a main window or it's iconified, don't show the
//     dialog. If showing up a dialog, while main window is iconified, program
//     will become unresponsive! */
//    if (top_level == NULL || state & GDK_WINDOW_STATE_ICONIFIED) {

//        queued_message = g_malloc(sizeof (queued_message_t));
//        queued_message->type = type;
//        queued_message->btn_mask = btn_mask;
//        queued_message->message = message;
//        message_queue = g_slist_append(message_queue, queued_message);
//        return NULL;
//    }

//    /*
//   * Do we have any queued up messages?  If so, pop them up.
//   */
//    display_queued_messages();

//    win = display_simple_dialog(type, btn_mask, message);

    g_free(message);

    return dlg;
}
コード例 #18
0
gboolean oseaclient_request_start_afkey_refresh (gpointer afdal_request_user_data)
{
	/* Ask for a af-key refresh, calling step 2 for processing it */
	AfdalRequestUserData * request_user_data = (AfdalRequestUserData *) oseaclient_request_user_data;	

	g_log (LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Asking af-kernel for new af-key...");
	      
	if (! oseaclient_session_refresh_key (request_user_data->server,
				   __oseaclient_request_start_afkey_refresh,
				   oseaclient_request_user_data))
		oseaclient_refresh_start_afkey_refresh_return_error ("Couldn't refresh key: not found valid connection to af-kernel",
								request_user_data);

	return FALSE;
}
コード例 #19
0
ファイル: chassis-mainloop.c プロジェクト: 280455936/Atlas
/**
 * forward libevent messages to the glib error log 
 */
static void event_log_use_glib(int libevent_log_level, const char *msg) {
	/* map libevent to glib log-levels */

	GLogLevelFlags glib_log_level = G_LOG_LEVEL_DEBUG;

	if (libevent_log_level == _EVENT_LOG_DEBUG) glib_log_level = G_LOG_LEVEL_DEBUG;
	else if (libevent_log_level == _EVENT_LOG_MSG) glib_log_level = G_LOG_LEVEL_MESSAGE;
	else if (libevent_log_level == _EVENT_LOG_WARN) glib_log_level = G_LOG_LEVEL_WARNING;
	else if (libevent_log_level == _EVENT_LOG_ERR) glib_log_level = G_LOG_LEVEL_CRITICAL;
    
    /*only error to be logged*/
    if (libevent_log_level == _EVENT_LOG_ERR) {
        g_log(G_LOG_DOMAIN, glib_log_level, "(libevent) %s", msg);
    }
}
コード例 #20
0
void
handle_g_error (GError ** error, const gchar * msg_format, ...)
{
	gchar *msg;
	va_list args;

	va_start (args, msg_format);
	msg = g_strdup_vprintf (msg_format, args);
	va_end (args);

	if (*error)
	{
		g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
			"\nGError raised: [%s]\nuser_message: [%s]\n", (*error)->message, msg);

		g_error_free (*error);

		*error = NULL;
	}
	else
		g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "\nerror raised: [%s]\n", msg);

	g_free (msg);
}
コード例 #21
0
void
g_relation_print (GRelation *relation)
{
  gint i;
  
  g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "*** all tuples (%d)", relation->count);
  
  g_hash_table_foreach (relation->all_tuples,
			g_relation_print_one,
			relation);
  
  for (i = 0; i < relation->fields; i += 1)
    {
      if (relation->hashed_tuple_tables[i] == NULL)
	continue;
      
      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "*** index %d", i);
      
      g_hash_table_foreach (relation->hashed_tuple_tables[i],
			    g_relation_print_index,
			    relation);
    }
  
}
コード例 #22
0
ファイル: theme.c プロジェクト: DaveDavenport/rofi
Distance rofi_theme_get_distance ( const widget *widget, const char *property, int def )
{
    ThemeWidget *wid = rofi_theme_find_widget ( widget->name, widget->state, FALSE );
    Property    *p   = rofi_theme_find_property ( wid, P_PADDING, property, FALSE );
    if ( p ) {
        if ( p->type == P_INTEGER ) {
            return (Distance){ p->value.i, PW_PX, SOLID };
        }
        else {
            return p->value.padding.left;
        }
    }
    g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Theme entry: #%s %s property %s unset.", widget->name, widget->state ? widget->state : "", property );
    return (Distance){ def, PW_PX, SOLID };
}
コード例 #23
0
ファイル: fo-tree.c プロジェクト: hrs-allbsd/xmlroff
static void
_debug_dump_hash_from_keys (gpointer data,
			    gpointer user_data)
{
  FoTreeSortedHashDumpData *hash_dump_data =
    (FoTreeSortedHashDumpData *) user_data;

  g_log (G_LOG_DOMAIN,
	 G_LOG_LEVEL_DEBUG,
	 "%s%s : %p",
	 hash_dump_data->indent,
	 (gchar *) data,
	 (gchar *) g_hash_table_lookup (hash_dump_data->hash,
					data));
}
コード例 #24
0
ファイル: world.c プロジェクト: carriercomm/wmud
/**
 * wmud_world_check_rooms:
 * @rooms: a #GSList of wmudRoom structs
 * @err: a #GError where this function can send back error messages
 *
 * Check rooms.
 *
 * Return value: %TRUE if everything goes well, %FALSE otherwise
 */
gboolean
wmud_world_check_rooms(GSList *rooms, GError **err)
{
    struct findData find_data = {rooms, 0, NULL};

    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Checking room consistency");

    g_slist_foreach(rooms, (GFunc)check_room_dups1, &find_data);

    if (find_data.found > 1) {
        g_set_error(err, WMUD_WORLD_ERROR, WMUD_WORLD_ERROR_DUPROOM, "Duplicate room names found. Please check your database!");
    }

    return find_data.found < 2;
}
コード例 #25
0
ファイル: zone-monitor.c プロジェクト: naadsm/naadsm
/**
 * Frees this model.  Does not free the production type names.
 *
 * @param self the model.
 */
void
local_free (struct ergadm_model_t_ *self)
{
    local_data_t *local_data;

#if DEBUG
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- ENTER free (%s)", MODEL_NAME);
#endif

    /* Free the dynamically-allocated parts. */
    local_data = (local_data_t *) (self->model_data);
    RPT_free_reporting (local_data->shape, TRUE);
    RPT_free_reporting (local_data->area, TRUE);
    RPT_free_reporting (local_data->num_separate_areas, TRUE);
    RPT_free_reporting (local_data->num_units, TRUE);
    RPT_free_reporting (local_data->num_animal_days_by_prodtype, TRUE);
    g_free (local_data);
    g_ptr_array_free (self->outputs, TRUE);
    g_free (self);

#if DEBUG
    g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "----- EXIT free (%s)", MODEL_NAME);
#endif
}
コード例 #26
0
ファイル: capture.c プロジェクト: home201448/wireshark
/**
 * Start a capture.
 *
 * @return TRUE if the capture starts successfully, FALSE otherwise.
 */
gboolean
capture_start(capture_options *capture_opts, capture_session *cap_session, void(*update_cb)(void))
{
  gboolean ret;
  GString *source;

  cap_session->state = CAPTURE_PREPARING;
  cap_session->count = 0;
  g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start ...");
  source = get_iface_list_string(capture_opts, IFLIST_SHOW_FILTER);
  cf_set_tempfile_source((capture_file *)cap_session->cf, source->str);
  g_string_free(source, TRUE);
  /* try to start the capture child process */
  ret = sync_pipe_start(capture_opts, cap_session, update_cb);
  if(!ret) {
      if(capture_opts->save_file != NULL) {
          g_free(capture_opts->save_file);
          capture_opts->save_file = NULL;
      }

      g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start failed.");
      cap_session->state = CAPTURE_STOPPED;
  } else {
      /* the capture child might not respond shortly after bringing it up */
      /* (for example: it will block if no input arrives from an input capture pipe (e.g. mkfifo)) */

      /* to prevent problems, bring the main GUI into "capture mode" right after a successful */
      /* spawn/exec of the capture child, without waiting for any response from it */
      capture_callback_invoke(capture_cb_capture_prepared, cap_session);

      if(capture_opts->show_info)
        capture_info_open(cap_session);
  }

  return ret;
}
コード例 #27
0
ファイル: packet_list.cpp プロジェクト: CTSRD-CHERI/wireshark
// Copied from ui/gtk/packet_list.c
void packet_list_resize_column(gint col)
{
    // xxx qtshark
//    gint col_width;
//    const gchar *long_str;

g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: packet_list_resize_column %d", col);
//    long_str = packet_list_get_widest_column_string(packetlist, col);
//    if(!long_str || strcmp("",long_str)==0)
//        /* If we get an empty string leave the width unchanged */
//        return;
//    column = gtk_tree_view_get_column (GTK_TREE_VIEW(packetlist->view), col);
//    col_width = get_default_col_size (packetlist->view, long_str);
//    gtk_tree_view_column_set_fixed_width(column, col_width);
}
コード例 #28
0
ファイル: world.c プロジェクト: carriercomm/wmud
/**
 * wmud_world_check_planes:
 * @planes: a #GSList of wmudPlane structs
 * @err: a #GError where this function can send back error messages
 *
 * Check for duplicate plane names in the @planes list.
 *
 * Return value: %TRUE if there are no duplicate names, %FALSE otherwise
 */
gboolean
wmud_world_check_planes(GSList *planes, GError **err)
{
    struct findData find_data = {planes, 0, NULL};

    g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Checking plane names for duplicates");

    g_slist_foreach(planes, (GFunc)check_plane_dups1, &find_data);

    if (find_data.found > 1) {
        g_set_error(err, WMUD_WORLD_ERROR, WMUD_WORLD_ERROR_DUPPLANE, "Duplicate plane names found. Please check your database!\n");
    }

    return find_data.found < 2;
}
コード例 #29
0
ファイル: iface_lists.c プロジェクト: dnstap/wireshark
/*
 * Get the global interface list.  Generate it if we haven't done so 
 * already.  This can be quite time consuming the first time, so 
 * record how long it takes in the info log.
 */
void
fill_in_local_interfaces(void)
{
	GTimeVal start_time;
	GTimeVal end_time;
	float elapsed;
	static gboolean initialized = FALSE;

	/* record the time we started, so we can log total time later */
	g_get_current_time(&start_time);
	g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "fill_in_local_interfaces() starts");
	
    if (!initialized) {
		/* do the actual work */
        scan_local_interfaces();
        initialized = TRUE;
    }
	/* log how long it took */
    g_get_current_time(&end_time);
    elapsed = (float) ((end_time.tv_sec - start_time.tv_sec) +
                        ((end_time.tv_usec - start_time.tv_usec) / 1e6));

    g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_INFO, "fill_in_local_interfaces() ends, taking %.3fs", elapsed);
}
コード例 #30
0
gboolean __oseaclient_request_start_afkey_refresh (AfDalNulData *data, gpointer afdal_request_user_data)
{
	AfdalRequestUserData * request_user_data = (AfdalRequestUserData *) oseaclient_request_user_data;	

	if (data->state == AFDAL_ERROR) {
		g_log (LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "Couldn't refresh af-key");
		g_free (request_user_data->server);
		g_free (request_user_data);
		oseaclient_refresh_start_afkey_refresh_return_error ("Couldn't refresh key.",
								request_user_data);
		return FALSE;
	}

	if (data->state == AFDAL_SESSION_EXPIRED) {
		g_static_mutex_lock (& oseaclient_request_session_expired_callback_is_active_mutex);

		if (oseaclient_request_session_expired_callback_is_active) {
			oseaclient_request_waiting_for_session_queue = g_list_append (afdal_request_waiting_for_session_queue,
										 request_user_data);
			g_log (LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Password dialog already shown. Putting action in queue.");
		} else {
			g_log (LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Session expired. Asking password to user...");
			oseaclient_request_session_expired_callback_is_active = TRUE;
			oseaclient_event_source_launch (afdal_request_start_session_refresh, request_user_data);
		}
		g_static_mutex_unlock (& oseaclient_request_session_expired_callback_is_active_mutex);
		oseaclient_nul_free (data);
		return FALSE;
	}
			
	oseaclient_nul_free (data);

	g_log (LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Af-Kernel gave us the new key");
	oseaclient_event_source_launch (__afdal_request_start_afkey_refresh_2, request_user_data);
	return FALSE;
}