/* Session management module for systems which understand the X Session
management protocol.
-Copyright (C) 2002-2011 Free Software Foundation, Inc.
+Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of GNU Emacs.
props[props_idx]->type = xstrdup (SmARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
- props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
+ props[props_idx]->vals[0].length = SBYTES (Vinvocation_name);
props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
++props_idx;
props[props_idx]->type = xstrdup (SmARRAY8);
props[props_idx]->num_vals = 1;
props[props_idx]->vals = &values[val_idx++];
- props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
+ props[props_idx]->vals[0].length = SBYTES (Vuser_login_name);
props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
++props_idx;
props[props_idx]->name = xstrdup (SmRestartCommand);
props[props_idx]->type = xstrdup (SmLISTofARRAY8);
/* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */
+ if (INT_MAX - 3 < initial_argc)
+ memory_full (SIZE_MAX);
i = 3 + initial_argc;
props[props_idx]->num_vals = i;
- vp = (SmPropValue *) xmalloc (i * sizeof(*vp));
+ vp = xnmalloc (i, sizeof *vp);
props[props_idx]->vals = vp;
props[props_idx]->vals[vp_idx].length = strlen (emacs_program);
props[props_idx]->vals[vp_idx++].value = emacs_program;
char errorstring[SM_ERRORSTRING_LEN];
char* previous_id = NULL;
SmcCallbacks callbacks;
- int name_len = 0;
+ ptrdiff_t name_len = 0;
ice_fd = -1;
doing_interact = False;
/* Construct the path to the Emacs program. */
if (! EQ (Vinvocation_directory, Qnil))
- name_len += strlen (SSDATA (Vinvocation_directory));
- name_len += strlen (SSDATA (Vinvocation_name));
+ name_len += SBYTES (Vinvocation_directory);
+ name_len += SBYTES (Vinvocation_name);
/* This malloc will not be freed, but it is only done once, and hopefully
not very large */
if (smc_conn != 0)
{
- Vx_session_id = make_string (client_id, strlen (client_id));
+ Vx_session_id = build_string (client_id);
#ifdef USE_GTK
- /* GTK creats a leader window by itself, but we need to tell
+ /* GTK creates a leader window by itself, but we need to tell
it about our client_id. */
gdk_x11_set_sm_client_id (client_id);
#else