Commit 9a03a777 authored by Roman Lebedev's avatar Roman Lebedev

Best practices: g_malloc + memset -> g_malloc0

parent 910cbf17
......@@ -513,8 +513,7 @@ void _camctl_unlock(const dt_camctl_t *c)
dt_camctl_t *dt_camctl_new()
{
dt_camctl_t *camctl=g_malloc(sizeof(dt_camctl_t));
memset(camctl,0,sizeof(dt_camctl_t));
dt_camctl_t *camctl = g_malloc0(sizeof(dt_camctl_t));
dt_print(DT_DEBUG_CAMCTL,"[camera_control] creating new context %p\n", camctl);
// Initialize gphoto2 context and setup dispatch callbacks
......@@ -635,8 +634,7 @@ void dt_camctl_detect_cameras(const dt_camctl_t *c)
for(int i=0; i<gp_list_count( available_cameras ); i++)
{
dt_camera_t *camera=g_malloc(sizeof(dt_camera_t));
memset( camera,0,sizeof(dt_camera_t));
dt_camera_t *camera = g_malloc0(sizeof(dt_camera_t));
const gchar *s;
gp_list_get_name (available_cameras, i, &s);
camera->model = g_strdup(s);
......
......@@ -58,8 +58,7 @@ static void _dt_collection_recount_callback_2(gpointer instance, uint8_t id, gpo
const dt_collection_t *
dt_collection_new (const dt_collection_t *clone)
{
dt_collection_t *collection = g_malloc (sizeof (dt_collection_t));
memset (collection,0,sizeof (dt_collection_t));
dt_collection_t *collection = g_malloc0(sizeof(dt_collection_t));
/* initialize collection context*/
if (clone) /* if clone is provided let's copy it into this context */
......
......@@ -685,8 +685,7 @@ dt_database_t *dt_database_init(char *alternative)
}
/* create database */
dt_database_t *db = (dt_database_t *)g_malloc(sizeof(dt_database_t));
memset(db,0,sizeof(dt_database_t));
dt_database_t *db = (dt_database_t *)g_malloc0(sizeof(dt_database_t));
db->dbfilename = g_strdup(dbfilename);
db->is_new_database = FALSE;
db->lock_acquired = FALSE;
......
......@@ -152,9 +152,8 @@ static void _on_name_lost(GDBusConnection *connection, const gchar *name, gpoint
struct dt_dbus_t *dt_dbus_init()
{
dt_dbus_t *dbus = (dt_dbus_t *)g_malloc(sizeof(dt_dbus_t));
dt_dbus_t *dbus = (dt_dbus_t *)g_malloc0(sizeof(dt_dbus_t));
if(!dbus) return NULL;
memset(dbus, 0, sizeof(dt_dbus_t));
dbus->introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, NULL);
......
......@@ -74,10 +74,8 @@ static void *_fswatch_thread(void *data)
dt_fswatch_t *fswatch=(dt_fswatch_t *)data;
uint32_t res=0;
uint32_t event_hdr_size=sizeof(inotify_event_t);
inotify_event_t *event_hdr=g_malloc(sizeof(inotify_event_t));
memset (event_hdr,0,event_hdr_size);
char *name=g_malloc(2048);
memset (name,0, 2048);
inotify_event_t *event_hdr = g_malloc0(sizeof(inotify_event_t));
char *name = g_malloc0(2048);
dt_print(DT_DEBUG_FSWATCH,"[fswatch_thread] Starting thread of context %p\n", data);
while(1)
{
......@@ -150,8 +148,7 @@ static void *_fswatch_thread(void *data)
const dt_fswatch_t* dt_fswatch_new()
{
dt_fswatch_t *fswatch=g_malloc(sizeof(dt_fswatch_t));
memset (fswatch, 0, sizeof(dt_fswatch_t));
dt_fswatch_t *fswatch = g_malloc0(sizeof(dt_fswatch_t));
if((fswatch->inotify_fd=inotify_init())==-1)
{
g_free(fswatch);
......
......@@ -88,8 +88,7 @@ dt_gpx_t *dt_gpx_new(const gchar *filename)
goto error;
/* allocate new dt_gpx_t context */
gpx = g_malloc(sizeof(dt_gpx_t));
memset(gpx, 0, sizeof(dt_gpx_t));
gpx = g_malloc0(sizeof(dt_gpx_t));
/* initialize the parser and start parse gpx xml data */
ctx = g_markup_parse_context_new(&_gpx_parser, 0, gpx, NULL);
......@@ -199,8 +198,7 @@ void _gpx_parser_start_element(GMarkupParseContext *ctx,
if (*attribute_name)
{
gpx->current_track_point = g_malloc(sizeof(_gpx_track_point_t));
memset(gpx->current_track_point, 0, sizeof(_gpx_track_point_t));
gpx->current_track_point = g_malloc0(sizeof(_gpx_track_point_t));
/* initialize with NAN for validation check */
gpx->current_track_point->longitude = NAN;
......
......@@ -77,8 +77,7 @@ _import_session_initialize_filmroll(dt_import_session_t *self, const char *path)
}
/* open one or initialize a filmroll for the session */
self->film = (dt_film_t *)g_malloc(sizeof(dt_film_t));
memset(self->film, 0, sizeof(dt_film_t));
self->film = (dt_film_t *)g_malloc0(sizeof(dt_film_t));
film_id = dt_film_new(self->film, path);
if (film_id == 0)
{
......@@ -148,8 +147,7 @@ dt_import_session_new()
{
dt_import_session_t *is;
is = (dt_import_session_t *)g_malloc(sizeof(dt_import_session_t));
memset(is, 0, sizeof(dt_import_session_t));
is = (dt_import_session_t *)g_malloc0(sizeof(dt_import_session_t));
dt_variables_params_init(&is->vp);
......
......@@ -251,8 +251,7 @@ static gboolean init_kwallet(backend_kwallet_context_t *context)
// General initialization. Takes care of all the other stuff.
const backend_kwallet_context_t* dt_pwstorage_kwallet_new()
{
backend_kwallet_context_t *context = g_malloc(sizeof(backend_kwallet_context_t));
memset(context, 0, sizeof(backend_kwallet_context_t));
backend_kwallet_context_t *context = g_malloc0(sizeof(backend_kwallet_context_t));
GError* error = NULL;
context->connection = g_bus_get_sync(G_BUS_TYPE_SESSION,NULL, &error);
......
......@@ -55,8 +55,7 @@ void _selection_update_collection(gpointer instance, gpointer user_data)
const dt_selection_t * dt_selection_new()
{
dt_selection_t *s = g_malloc(sizeof(dt_selection_t));
memset(s, 0, sizeof(dt_selection_t));
dt_selection_t *s = g_malloc0(sizeof(dt_selection_t));
/* initialize the collection copy */
_selection_update_collection(NULL, (gpointer)s);
......
......@@ -263,10 +263,8 @@ gboolean _variable_get_value(dt_variables_params_t *params, gchar *variable,gcha
void dt_variables_params_init(dt_variables_params_t **params)
{
*params=g_malloc(sizeof(dt_variables_params_t));
memset(*params ,0,sizeof(dt_variables_params_t));
(*params)->data = g_malloc(sizeof(dt_variables_data_t));
memset((*params)->data ,0,sizeof(dt_variables_data_t));
*params = g_malloc0(sizeof(dt_variables_params_t));
(*params)->data = g_malloc0(sizeof(dt_variables_data_t));
(*params)->data->time=time(NULL);
(*params)->sequence = -1;
}
......
......@@ -75,8 +75,7 @@ static inline char *dt_conf_get_var(const char *name)
}
// still no luck? insert garbage:
char *garbage = (char *)g_malloc(sizeof(int32_t));
memset(garbage, 0, sizeof(int32_t));
char *garbage = (char *)g_malloc0(sizeof(int32_t));
g_hash_table_insert(darktable.conf->table, g_strdup(name), garbage);
return garbage;
}
......
......@@ -89,8 +89,7 @@ int32_t dt_camera_capture_job_run(dt_job_t *job)
// register listener
dt_camctl_listener_t *listener;
listener = g_malloc(sizeof(dt_camctl_listener_t));
memset(listener, 0, sizeof(dt_camctl_listener_t));
listener = g_malloc0(sizeof(dt_camctl_listener_t));
listener->data=t;
listener->image_downloaded=_camera_capture_image_downloaded;
listener->request_image_path=_camera_request_image_path;
......
......@@ -87,8 +87,7 @@ static GType _signal_type;
dt_control_signal_t *dt_control_signal_init()
{
dt_control_signal_t *ctlsig = g_malloc(sizeof(dt_control_signal_t));
memset(ctlsig, 0, sizeof(dt_control_signal_t));
dt_control_signal_t *ctlsig = g_malloc0(sizeof(dt_control_signal_t));
/* setup dummy gobject typeinfo */
GTypeQuery query;
......
......@@ -1482,8 +1482,7 @@ void dt_iop_gui_init_blending(GtkWidget *iopw, dt_iop_module_t *module)
{
const int bs = DT_PIXEL_APPLY_DPI(14);
module->blend_data = g_malloc(sizeof(dt_iop_gui_blend_data_t));
memset(module->blend_data, 0, sizeof(dt_iop_gui_blend_data_t));
module->blend_data = g_malloc0(sizeof(dt_iop_gui_blend_data_t));
dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;
bd->iopw = iopw;
......
......@@ -393,10 +393,8 @@ dt_iop_load_module_by_so(dt_iop_module_t *module, dt_iop_module_so_t *so, dt_dev
module->init(module);
/* initialize blendop params and default values */
module->blend_params=g_malloc(sizeof(dt_develop_blend_params_t));
module->default_blendop_params=g_malloc(sizeof(dt_develop_blend_params_t));
memset(module->blend_params, 0, sizeof(dt_develop_blend_params_t));
memset(module->default_blendop_params, 0, sizeof(dt_develop_blend_params_t));
module->blend_params = g_malloc0(sizeof(dt_develop_blend_params_t));
module->default_blendop_params = g_malloc0(sizeof(dt_develop_blend_params_t));
memcpy(module->default_blendop_params, &_default_blendop_params, sizeof(dt_develop_blend_params_t));
memcpy(module->blend_params, &_default_blendop_params, sizeof(dt_develop_blend_params_t));
......
......@@ -1250,8 +1250,7 @@ void init_main_table(GtkWidget *container)
*/
dt_ui_t *dt_ui_initialize(int argc, char **argv)
{
dt_ui_t *ui=g_malloc(sizeof(dt_ui_t));
memset(ui,0,sizeof(dt_ui_t));
dt_ui_t *ui = g_malloc0(sizeof(dt_ui_t));
return ui;
}
......
......@@ -149,8 +149,7 @@ void init(dt_imageio_module_storage_t *self)
void*
get_params(dt_imageio_module_storage_t *self)
{
dt_imageio_email_t *d = (dt_imageio_email_t *)g_malloc(sizeof(dt_imageio_email_t));
memset( d,0,sizeof( dt_imageio_email_t));
dt_imageio_email_t *d = (dt_imageio_email_t *)g_malloc0(sizeof(dt_imageio_email_t));
return d;
}
......
......@@ -127,8 +127,7 @@ static _flickr_api_context_t *_flickr_api_authenticate(dt_storage_flickr_gui_dat
gchar *token;
char *flickr_user_token = NULL;
gint result;
_flickr_api_context_t *ctx = (_flickr_api_context_t *)g_malloc(sizeof(_flickr_api_context_t));
memset(ctx,0,sizeof(_flickr_api_context_t));
_flickr_api_context_t *ctx = (_flickr_api_context_t *)g_malloc0(sizeof(_flickr_api_context_t));
flickcurl_init ();
ctx->fc = flickcurl_new ();
......@@ -264,10 +263,9 @@ static _flickr_api_context_t *_flickr_api_authenticate(dt_storage_flickr_gui_dat
static flickcurl_upload_status *_flickr_api_upload_photo( dt_storage_flickr_params_t *p, char *fname, char *caption, char *description, gint imgid )
{
flickcurl_upload_params *params = g_malloc(sizeof(flickcurl_upload_params));
flickcurl_upload_params *params = g_malloc0(sizeof(flickcurl_upload_params));
flickcurl_upload_status *status;
memset(params,0,sizeof(flickcurl_upload_params));
params->safety_level = 1; //Defaults to safe photos
params->content_type = 1; //Defaults to photo (we don't support video!)
......@@ -464,8 +462,7 @@ focus_out(GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
void
gui_init (dt_imageio_module_storage_t *self)
{
self->gui_data = (dt_storage_flickr_gui_data_t *)g_malloc(sizeof(dt_storage_flickr_gui_data_t));
memset(self->gui_data,0,sizeof(dt_storage_flickr_gui_data_t));
self->gui_data = (dt_storage_flickr_gui_data_t *)g_malloc0(sizeof(dt_storage_flickr_gui_data_t));
dt_storage_flickr_gui_data_t *ui= self->gui_data;
self->widget = gtk_vbox_new(FALSE, 0);
......@@ -765,9 +762,8 @@ get_params(dt_imageio_module_storage_t *self)
// have to return the size of the struct to store (i.e. without all the variable pointers at the end)
// TODO: if a hash to encrypted data is stored here, return only this size and store it at the beginning of the struct!
dt_storage_flickr_gui_data_t *ui =(dt_storage_flickr_gui_data_t *)self->gui_data;
dt_storage_flickr_params_t *d = (dt_storage_flickr_params_t *)g_malloc(sizeof(dt_storage_flickr_params_t));
dt_storage_flickr_params_t *d = (dt_storage_flickr_params_t *)g_malloc0(sizeof(dt_storage_flickr_params_t));
if(!d) return NULL;
memset(d,0,sizeof(dt_storage_flickr_params_t));
d->hash = 1;
// fill d from controls in ui
......
......@@ -218,8 +218,7 @@ static gchar *picasa_get_user_refresh_token(PicasaContext *ctx);
static size_t _picasa_api_buffer_write_func(void *ptr, size_t size, size_t nmemb, void *stream)
{
_buffer_t *buffer=(_buffer_t *)stream;
char *newdata=g_malloc(buffer->size+nmemb+1);
memset(newdata,0, buffer->size+nmemb+1);
char *newdata = g_malloc0(buffer->size+nmemb+1);
if( buffer->data != NULL ) memcpy(newdata, buffer->data, buffer->size);
memcpy(newdata+buffer->size, ptr, nmemb);
g_free( buffer->data );
......
......@@ -271,9 +271,9 @@ void reload_defaults(dt_iop_module_t *self)
void init(dt_iop_module_t *module)
{
// module->data = g_malloc(sizeof(dt_iop_invert_data_t));
module->params = g_malloc(sizeof(dt_iop_invert_params_t));
module->default_params = g_malloc(sizeof(dt_iop_invert_params_t));
// module->data = g_malloc0(sizeof(dt_iop_invert_data_t));
module->params = g_malloc0(sizeof(dt_iop_invert_params_t));
module->default_params = g_malloc0(sizeof(dt_iop_invert_params_t));
module->default_enabled = 0;
module->params_size = sizeof(dt_iop_invert_params_t);
module->gui_data = NULL;
......@@ -297,7 +297,7 @@ void commit_params(struct dt_iop_module_t *self, dt_iop_params_t *params, dt_dev
void init_pipe(struct dt_iop_module_t *self, dt_dev_pixelpipe_t *pipe, dt_dev_pixelpipe_iop_t *piece)
{
piece->data = g_malloc(sizeof(dt_iop_invert_data_t));
piece->data = g_malloc0(sizeof(dt_iop_invert_data_t));
self->commit_params(self, self->default_params, pipe, piece);
}
......@@ -326,7 +326,7 @@ void gui_update(dt_iop_module_t *self)
void gui_init(dt_iop_module_t *self)
{
self->gui_data = g_malloc(sizeof(dt_iop_invert_gui_data_t));
self->gui_data = g_malloc0(sizeof(dt_iop_invert_gui_data_t));
dt_iop_invert_gui_data_t *g = (dt_iop_invert_gui_data_t *)self->gui_data;
dt_iop_invert_params_t *p = (dt_iop_invert_params_t *)self->params;
......
......@@ -609,8 +609,7 @@ void process (struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, void
int stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32,roi_out->width);
/* create cairo memory surface */
guint8 *image= (guint8 *)g_malloc (stride*roi_out->height);
memset (image,0,(size_t)stride*roi_out->height);
guint8 *image= (guint8 *)g_malloc0(stride*roi_out->height);
cairo_surface_t *surface = cairo_image_surface_create_for_data (image,CAIRO_FORMAT_ARGB32,roi_out->width,roi_out->height,stride);
if (cairo_surface_status(surface)!= CAIRO_STATUS_SUCCESS)
{
......
......@@ -102,8 +102,7 @@ int expandable()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_backgroundjobs_t *d = (dt_lib_backgroundjobs_t *)g_malloc(sizeof(dt_lib_backgroundjobs_t));
memset(d,0,sizeof(dt_lib_backgroundjobs_t));
dt_lib_backgroundjobs_t *d = (dt_lib_backgroundjobs_t *)g_malloc0(sizeof(dt_lib_backgroundjobs_t));
self->data = (void *)d;
d->jobs = g_hash_table_new(g_direct_hash,g_direct_equal);
......
......@@ -74,7 +74,7 @@ int position()
void gui_init(dt_lib_module_t *self)
{
dt_lib_file_manager_t *d = (dt_lib_file_manager_t *)g_malloc(sizeof(dt_lib_file_manager_t));
dt_lib_file_manager_t *d = (dt_lib_file_manager_t *)g_malloc0(sizeof(dt_lib_file_manager_t));
self->data = (void *)d;
d->terminal = VTE_TERMINAL(vte_terminal_new());
......
......@@ -109,8 +109,7 @@ static void _lib_histogram_change_callback(gpointer instance, gpointer user_data
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_histogram_t *d = (dt_lib_histogram_t *)g_malloc(sizeof(dt_lib_histogram_t));
memset(d,0,sizeof(dt_lib_histogram_t));
dt_lib_histogram_t *d = (dt_lib_histogram_t *)g_malloc0(sizeof(dt_lib_histogram_t));
self->data = (void *)d;
d->red = dt_conf_get_bool("plugins/darkroom/histogram/show_red");
......
......@@ -94,9 +94,8 @@ void connect_key_accels(dt_lib_module_t *self)
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_history_t *d = (dt_lib_history_t *)g_malloc(sizeof(dt_lib_history_t));
dt_lib_history_t *d = (dt_lib_history_t *)g_malloc0(sizeof(dt_lib_history_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_history_t));
self->widget = gtk_vbox_new (FALSE,2);
d->history_box = gtk_vbox_new(FALSE,0);
......
......@@ -142,8 +142,7 @@ static void _lib_import_scan_devices_callback(GtkButton *button,gpointer data)
/* show import from camera dialog */
static void _lib_import_from_camera_callback(GtkButton *button,gpointer data)
{
dt_camera_import_dialog_param_t *params=(dt_camera_import_dialog_param_t *)g_malloc(sizeof(dt_camera_import_dialog_param_t));
memset( params, 0, sizeof(dt_camera_import_dialog_param_t));
dt_camera_import_dialog_param_t *params=(dt_camera_import_dialog_param_t *)g_malloc0(sizeof(dt_camera_import_dialog_param_t));
params->camera = (dt_camera_t*)data;
dt_camera_import_dialog_new(params);
......@@ -822,8 +821,7 @@ static void _lib_import_folder_callback(GtkWidget *widget,gpointer user_data)
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_import_t *d = (dt_lib_import_t *)g_malloc(sizeof(dt_lib_import_t));
memset(d,0,sizeof(dt_lib_import_t));
dt_lib_import_t *d = (dt_lib_import_t *)g_malloc0(sizeof(dt_lib_import_t));
self->data = (void *)d;
self->widget = gtk_vbox_new(FALSE, 5);
......
......@@ -177,8 +177,7 @@ static size_t _lib_location_curl_write_data(void *buffer, size_t size, size_t nm
{
dt_lib_location_t *lib = (dt_lib_location_t *)userp;
char *newdata = g_malloc(lib->response_size + nmemb + 1);
memset(newdata,0, lib->response_size + nmemb + 1);
char *newdata = g_malloc0(lib->response_size + nmemb + 1);
if( lib->response != NULL )
memcpy(newdata, lib->response, lib->response_size);
memcpy(newdata + lib->response_size, buffer, nmemb);
......@@ -393,10 +392,9 @@ static void _lib_location_parser_start_element(GMarkupParseContext *cxt,
return;
/* create new place */
_lib_location_result_t *place = g_malloc(sizeof(_lib_location_result_t));
_lib_location_result_t *place = g_malloc0(sizeof(_lib_location_result_t));
if(!place) return;
memset(place, 0, sizeof(_lib_location_result_t));
place->lon = NAN;
place->lat = NAN;
......
......@@ -1434,9 +1434,8 @@ void gui_init(dt_lib_module_t *self)
const int bs2 = DT_PIXEL_APPLY_DPI(13);
/* initialize ui widgets */
dt_lib_masks_t *d = (dt_lib_masks_t *)g_malloc(sizeof(dt_lib_masks_t));
dt_lib_masks_t *d = (dt_lib_masks_t *)g_malloc0(sizeof(dt_lib_masks_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_masks_t));
d->gui_reset = 0;
//initialise all masks icons
......
......@@ -437,7 +437,7 @@ void connect_key_accels(dt_lib_module_t *self)
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_metadata_view_t *d = (dt_lib_metadata_view_t *)g_malloc(sizeof(dt_lib_metadata_view_t));
dt_lib_metadata_view_t *d = (dt_lib_metadata_view_t *)g_malloc0(sizeof(dt_lib_metadata_view_t));
self->data = (void *)d;
_lib_metatdata_view_init_labels();
......
......@@ -94,9 +94,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_modulegroups_t *d = (dt_lib_modulegroups_t *)g_malloc(sizeof(dt_lib_modulegroups_t));
dt_lib_modulegroups_t *d = (dt_lib_modulegroups_t *)g_malloc0(sizeof(dt_lib_modulegroups_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_modulegroups_t));
self->widget = gtk_hbox_new(TRUE,2);
......
......@@ -75,8 +75,7 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_modulelist_t *d = (dt_lib_modulelist_t *)g_malloc(sizeof(dt_lib_modulelist_t));
memset(d,0,sizeof(dt_lib_modulelist_t));
dt_lib_modulelist_t *d = (dt_lib_modulelist_t *)g_malloc0(sizeof(dt_lib_modulelist_t));
self->data = (void *)d;
self->widget = gtk_scrolled_window_new(NULL, NULL); //GTK_ADJUSTMENT(gtk_adjustment_new(200, 100, 200, 10, 100, 100))
gtk_widget_set_size_request(self->widget, -1, DT_PIXEL_APPLY_DPI(208));
......
......@@ -86,9 +86,8 @@ static void _lib_navigation_control_redraw_callback(gpointer instance, gpointer
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_navigation_t *d = (dt_lib_navigation_t *)g_malloc(sizeof(dt_lib_navigation_t));
dt_lib_navigation_t *d = (dt_lib_navigation_t *)g_malloc0(sizeof(dt_lib_navigation_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_navigation_t));
/* create drawingarea */
self->widget = gtk_drawing_area_new();
......
......@@ -274,17 +274,15 @@ void gui_reset(dt_lib_module_t *self)
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_snapshots_t *d = (dt_lib_snapshots_t *)g_malloc(sizeof(dt_lib_snapshots_t));
dt_lib_snapshots_t *d = (dt_lib_snapshots_t *)g_malloc0(sizeof(dt_lib_snapshots_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_snapshots_t));
/* initialize snapshot storages */
d->size = 4;
d->snapshot = (dt_lib_snapshot_t *)g_malloc(sizeof(dt_lib_snapshot_t)*d->size);
d->snapshot = (dt_lib_snapshot_t *)g_malloc0(sizeof(dt_lib_snapshot_t)*d->size);
d->vp_xpointer = 0.5;
d->vp_ypointer = 0.5;
d->vertical = TRUE;
memset(d->snapshot,0,sizeof(dt_lib_snapshot_t)*d->size);
/* initialize ui containers */
self->widget = gtk_vbox_new(FALSE,2);
......
......@@ -61,9 +61,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_colorlabels_t *d = (dt_lib_colorlabels_t *)g_malloc(sizeof(dt_lib_colorlabels_t));
dt_lib_colorlabels_t *d = (dt_lib_colorlabels_t *)g_malloc0(sizeof(dt_lib_colorlabels_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_colorlabels_t));
/* setup list of tooltips */
d->tooltips[0] = _("toggle red label\nof selected images (f1)");
......
......@@ -80,9 +80,8 @@ void gui_init(dt_lib_module_t *self)
char filename[PATH_MAX];
char datadir[PATH_MAX];
/* initialize ui widgets */
dt_lib_darktable_t *d = (dt_lib_darktable_t *)g_malloc(sizeof(dt_lib_darktable_t));
dt_lib_darktable_t *d = (dt_lib_darktable_t *)g_malloc0(sizeof(dt_lib_darktable_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_darktable_t));
/* create drawing area */
self->widget = gtk_event_box_new();
......
......@@ -97,9 +97,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_tool_filter_t *d = (dt_lib_tool_filter_t *)g_malloc(sizeof(dt_lib_tool_filter_t));
dt_lib_tool_filter_t *d = (dt_lib_tool_filter_t *)g_malloc0(sizeof(dt_lib_tool_filter_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_tool_filter_t));
self->widget = gtk_hbox_new(FALSE,2);
......
......@@ -69,7 +69,7 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_tool_preferences_t *d = (dt_lib_tool_preferences_t *)g_malloc(sizeof(dt_lib_tool_preferences_t));
dt_lib_tool_preferences_t *d = (dt_lib_tool_preferences_t *)g_malloc0(sizeof(dt_lib_tool_preferences_t));
self->data = (void *)d;
self->widget = gtk_hbox_new(FALSE,2);
......
......@@ -66,9 +66,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_hinter_t *d = (dt_lib_hinter_t *)g_malloc(sizeof(dt_lib_hinter_t));
dt_lib_hinter_t *d = (dt_lib_hinter_t *)g_malloc0(sizeof(dt_lib_hinter_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_hinter_t));
self->widget = gtk_event_box_new();
d->label = gtk_label_new("");
......
......@@ -84,9 +84,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_tool_lighttable_t *d = (dt_lib_tool_lighttable_t *)g_malloc(sizeof(dt_lib_tool_lighttable_t));
dt_lib_tool_lighttable_t *d = (dt_lib_tool_lighttable_t *)g_malloc0(sizeof(dt_lib_tool_lighttable_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_tool_lighttable_t));
self->widget = gtk_hbox_new(FALSE,2);
......
......@@ -59,9 +59,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_module_toolbox_t *d = (dt_lib_module_toolbox_t *)g_malloc(sizeof(dt_lib_module_toolbox_t));
dt_lib_module_toolbox_t *d = (dt_lib_module_toolbox_t *)g_malloc0(sizeof(dt_lib_module_toolbox_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_module_toolbox_t));
/* the toolbar container */
d->container = self->widget = gtk_hbox_new(FALSE,10);
......
......@@ -76,9 +76,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_ratings_t *d = (dt_lib_ratings_t *)g_malloc(sizeof(dt_lib_ratings_t));
dt_lib_ratings_t *d = (dt_lib_ratings_t *)g_malloc0(sizeof(dt_lib_ratings_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_ratings_t));
/* create a centered drawing area within alignment */
self->widget = gtk_alignment_new(0.5, 0.5, 0, 0);
......
......@@ -59,9 +59,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_view_toolbox_t *d = (dt_lib_view_toolbox_t *)g_malloc(sizeof(dt_lib_view_toolbox_t));
dt_lib_view_toolbox_t *d = (dt_lib_view_toolbox_t *)g_malloc0(sizeof(dt_lib_view_toolbox_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_view_toolbox_t));
/* the toolbar container */
d->container = self->widget = gtk_hbox_new(FALSE,10);
......
......@@ -69,9 +69,8 @@ int position()
void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_viewswitcher_t *d = (dt_lib_viewswitcher_t *)g_malloc(sizeof(dt_lib_viewswitcher_t));
dt_lib_viewswitcher_t *d = (dt_lib_viewswitcher_t *)g_malloc0(sizeof(dt_lib_viewswitcher_t));
self->data = (void *)d;
memset(d,0,sizeof(dt_lib_viewswitcher_t));
self->widget = gtk_hbox_new(FALSE,5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment