Cleanup whitespace

git-svn-id: http://tint2.googlecode.com/svn/trunk@655 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000 2015-01-20 02:23:28 +00:00 committed by mrovi9000@gmail.com
parent fc4b29631f
commit 45a2156c12
3 changed files with 170 additions and 170 deletions

View file

@ -169,13 +169,13 @@ static XSettingsResult fetch_card32 (XSettingsBuffer *buffer, CARD32 *result)
static XSettingsResult fetch_card8 (XSettingsBuffer *buffer, CARD8 *result) static XSettingsResult fetch_card8 (XSettingsBuffer *buffer, CARD8 *result)
{ {
if (BYTES_LEFT (buffer) < 1) if (BYTES_LEFT (buffer) < 1)
return XSETTINGS_ACCESS; return XSETTINGS_ACCESS;
*result = *(CARD8 *)buffer->pos; *result = *(CARD8 *)buffer->pos;
buffer->pos += 1; buffer->pos += 1;
return XSETTINGS_SUCCESS; return XSETTINGS_SUCCESS;
} }
#define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1))) #define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))

View file

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* Author: Owen Taylor, Red Hat, Inc. * Author: Owen Taylor, Red Hat, Inc.
@ -31,238 +31,238 @@
XSettingsSetting * XSettingsSetting *
xsettings_setting_copy (XSettingsSetting *setting) xsettings_setting_copy (XSettingsSetting *setting)
{ {
XSettingsSetting *result; XSettingsSetting *result;
size_t str_len; size_t str_len;
result = malloc (sizeof *result);
if (!result)
return NULL;
str_len = strlen (setting->name); result = malloc (sizeof *result);
result->name = malloc (str_len + 1); if (!result)
if (!result->name) return NULL;
goto err;
memcpy (result->name, setting->name, str_len + 1); str_len = strlen (setting->name);
result->name = malloc (str_len + 1);
if (!result->name)
goto err;
result->type = setting->type; memcpy (result->name, setting->name, str_len + 1);
switch (setting->type) result->type = setting->type;
{
case XSETTINGS_TYPE_INT:
result->data.v_int = setting->data.v_int;
break;
case XSETTINGS_TYPE_COLOR:
result->data.v_color = setting->data.v_color;
break;
case XSETTINGS_TYPE_STRING:
str_len = strlen (setting->data.v_string);
result->data.v_string = malloc (str_len + 1);
if (!result->data.v_string)
goto err;
memcpy (result->data.v_string, setting->data.v_string, str_len + 1); switch (setting->type)
break; {
default: case XSETTINGS_TYPE_INT:
break; result->data.v_int = setting->data.v_int;
} break;
case XSETTINGS_TYPE_COLOR:
result->data.v_color = setting->data.v_color;
break;
case XSETTINGS_TYPE_STRING:
str_len = strlen (setting->data.v_string);
result->data.v_string = malloc (str_len + 1);
if (!result->data.v_string)
goto err;
result->last_change_serial = setting->last_change_serial; memcpy (result->data.v_string, setting->data.v_string, str_len + 1);
break;
default:
break;
}
return result; result->last_change_serial = setting->last_change_serial;
err: return result;
if (result->name)
free (result->name); err:
free (result); if (result->name)
free (result->name);
return NULL; free (result);
return NULL;
} }
XSettingsList * XSettingsList *
xsettings_list_copy (XSettingsList *list) xsettings_list_copy (XSettingsList *list)
{ {
XSettingsList *new = NULL; XSettingsList *new = NULL;
XSettingsList *old_iter = list; XSettingsList *old_iter = list;
XSettingsList *new_iter = NULL; XSettingsList *new_iter = NULL;
while (old_iter) while (old_iter)
{
XSettingsList *new_node;
new_node = malloc (sizeof *new_node);
if (!new_node)
goto error;
new_node->setting = xsettings_setting_copy (old_iter->setting);
if (!new_node->setting)
{ {
free (new_node); XSettingsList *new_node;
goto error;
new_node = malloc (sizeof *new_node);
if (!new_node)
goto error;
new_node->setting = xsettings_setting_copy (old_iter->setting);
if (!new_node->setting)
{
free (new_node);
goto error;
}
if (new_iter)
new_iter->next = new_node;
else
new = new_node;
new_iter = new_node;
old_iter = old_iter->next;
} }
if (new_iter) return new;
new_iter->next = new_node;
else
new = new_node;
new_iter = new_node; error:
xsettings_list_free (new);
old_iter = old_iter->next; return NULL;
}
return new;
error:
xsettings_list_free (new);
return NULL;
} }
int int
xsettings_setting_equal (XSettingsSetting *setting_a, xsettings_setting_equal (XSettingsSetting *setting_a,
XSettingsSetting *setting_b) XSettingsSetting *setting_b)
{ {
if (setting_a->type != setting_b->type) if (setting_a->type != setting_b->type)
return 0; return 0;
if (strcmp (setting_a->name, setting_b->name) != 0) if (strcmp (setting_a->name, setting_b->name) != 0)
return 0; return 0;
switch (setting_a->type) switch (setting_a->type)
{ {
case XSETTINGS_TYPE_INT: case XSETTINGS_TYPE_INT:
return setting_a->data.v_int == setting_b->data.v_int; return setting_a->data.v_int == setting_b->data.v_int;
case XSETTINGS_TYPE_COLOR: case XSETTINGS_TYPE_COLOR:
return (setting_a->data.v_color.red == setting_b->data.v_color.red && return (setting_a->data.v_color.red == setting_b->data.v_color.red &&
setting_a->data.v_color.green == setting_b->data.v_color.green && setting_a->data.v_color.green == setting_b->data.v_color.green &&
setting_a->data.v_color.blue == setting_b->data.v_color.blue && setting_a->data.v_color.blue == setting_b->data.v_color.blue &&
setting_a->data.v_color.alpha == setting_b->data.v_color.alpha); setting_a->data.v_color.alpha == setting_b->data.v_color.alpha);
case XSETTINGS_TYPE_STRING: case XSETTINGS_TYPE_STRING:
return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0; return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0;
default: default:
break; break;
} }
return 0; return 0;
} }
void void
xsettings_setting_free (XSettingsSetting *setting) xsettings_setting_free (XSettingsSetting *setting)
{ {
if (setting->type == XSETTINGS_TYPE_STRING) if (setting->type == XSETTINGS_TYPE_STRING)
free (setting->data.v_string); free (setting->data.v_string);
if (setting->name) if (setting->name)
free (setting->name); free (setting->name);
free (setting); free (setting);
} }
void void
xsettings_list_free (XSettingsList *list) xsettings_list_free (XSettingsList *list)
{ {
while (list) while (list)
{ {
XSettingsList *next = list->next; XSettingsList *next = list->next;
xsettings_setting_free (list->setting); xsettings_setting_free (list->setting);
free (list); free (list);
list = next; list = next;
} }
} }
XSettingsResult XSettingsResult
xsettings_list_insert (XSettingsList **list, xsettings_list_insert (XSettingsList **list,
XSettingsSetting *setting) XSettingsSetting *setting)
{ {
XSettingsList *node; XSettingsList *node;
XSettingsList *iter; XSettingsList *iter;
XSettingsList *last = NULL; XSettingsList *last = NULL;
node = malloc (sizeof *node); node = malloc (sizeof *node);
if (!node) if (!node)
return XSETTINGS_NO_MEM; return XSETTINGS_NO_MEM;
node->setting = setting; node->setting = setting;
iter = *list; iter = *list;
while (iter) while (iter)
{
int cmp = strcmp (setting->name, iter->setting->name);
if (cmp < 0)
break;
else if (cmp == 0)
{ {
free (node); int cmp = strcmp (setting->name, iter->setting->name);
return XSETTINGS_DUPLICATE_ENTRY;
if (cmp < 0)
break;
else if (cmp == 0)
{
free (node);
return XSETTINGS_DUPLICATE_ENTRY;
}
last = iter;
iter = iter->next;
} }
last = iter; if (last)
iter = iter->next; last->next = node;
} else
*list = node;
if (last)
last->next = node; node->next = iter;
else
*list = node; return XSETTINGS_SUCCESS;
node->next = iter;
return XSETTINGS_SUCCESS;
} }
XSettingsResult XSettingsResult
xsettings_list_delete (XSettingsList **list, xsettings_list_delete (XSettingsList **list,
const char *name) const char *name)
{ {
XSettingsList *iter; XSettingsList *iter;
XSettingsList *last = NULL; XSettingsList *last = NULL;
iter = *list; iter = *list;
while (iter) while (iter)
{
if (strcmp (name, iter->setting->name) == 0)
{ {
if (last) if (strcmp (name, iter->setting->name) == 0)
last->next = iter->next; {
else if (last)
*list = iter->next; last->next = iter->next;
else
xsettings_setting_free (iter->setting); *list = iter->next;
free (iter);
return XSETTINGS_SUCCESS; xsettings_setting_free (iter->setting);
free (iter);
return XSETTINGS_SUCCESS;
}
last = iter;
iter = iter->next;
} }
last = iter; return XSETTINGS_FAILED;
iter = iter->next;
}
return XSETTINGS_FAILED;
} }
XSettingsSetting * XSettingsSetting *
xsettings_list_lookup (XSettingsList *list, xsettings_list_lookup (XSettingsList *list,
const char *name) const char *name)
{ {
XSettingsList *iter; XSettingsList *iter;
iter = list; iter = list;
while (iter) while (iter)
{ {
if (strcmp (name, iter->setting->name) == 0) if (strcmp (name, iter->setting->name) == 0)
return iter->setting; return iter->setting;
iter = iter->next; iter = iter->next;
} }
return NULL; return NULL;
} }
char char
xsettings_byte_order (void) xsettings_byte_order (void)
{ {
CARD32 myint = 0x01020304; CARD32 myint = 0x01020304;
return (*(char *)&myint == 1) ? MSBFirst : LSBFirst; return (*(char *)&myint == 1) ? MSBFirst : LSBFirst;
} }

View file

@ -18,7 +18,7 @@
**************************************************************************/ **************************************************************************/
#ifdef HAVE_VERSION_H #ifdef HAVE_VERSION_H
#include "version.h" #include "version.h"
#endif #endif
#include "main.h" #include "main.h"
#include "common.h" #include "common.h"
@ -368,7 +368,7 @@ static void menuQuit()
if (g_cmd_property) if (g_cmd_property)
g_free(g_cmd_property); g_free(g_cmd_property);
gtk_main_quit (); gtk_main_quit ();
} }