Move hex_digits to rodata

Turn a string into a constant array.
This commit is contained in:
Matthias Clasen 2009-04-03 00:35:43 -04:00
parent 25ff8ee748
commit e6e82c51a6

View File

@ -359,7 +359,7 @@ escape_byte_string (const char *str)
int num_invalid, i; int num_invalid, i;
char *escaped_val, *p; char *escaped_val, *p;
unsigned char c; unsigned char c;
char *hex_digits = "0123456789abcdef"; const char hex_digits[] = "0123456789abcdef";
len = strlen (str); len = strlen (str);
@ -396,7 +396,7 @@ escape_byte_string (const char *str)
} }
/* /*
* g_file_attribute_value_as_string: * _g_file_attribute_value_as_string:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Converts a #GFileAttributeValue to a string for display. * Converts a #GFileAttributeValue to a string for display.
@ -404,7 +404,7 @@ escape_byte_string (const char *str)
* *
* Returns: a string from the @attr, %NULL on error, or "<invalid>" * Returns: a string from the @attr, %NULL on error, or "<invalid>"
* if @attr is of type %G_FILE_ATTRIBUTE_TYPE_INVALID. * if @attr is of type %G_FILE_ATTRIBUTE_TYPE_INVALID.
**/ */
char * char *
_g_file_attribute_value_as_string (const GFileAttributeValue *attr) _g_file_attribute_value_as_string (const GFileAttributeValue *attr)
{ {
@ -450,14 +450,14 @@ _g_file_attribute_value_as_string (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_string: * _g_file_attribute_value_get_string:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the string from a file attribute value. If the value is not the * Gets the string from a file attribute value. If the value is not the
* right type then %NULL will be returned. * right type then %NULL will be returned.
* *
* Returns: the string value contained within the attribute, or %NULL. * Returns: the string value contained within the attribute, or %NULL.
**/ */
const char * const char *
_g_file_attribute_value_get_string (const GFileAttributeValue *attr) _g_file_attribute_value_get_string (const GFileAttributeValue *attr)
{ {
@ -470,14 +470,14 @@ _g_file_attribute_value_get_string (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_byte_string: * _g_file_attribute_value_get_byte_string:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the byte string from a file attribute value. If the value is not the * Gets the byte string from a file attribute value. If the value is not the
* right type then %NULL will be returned. * right type then %NULL will be returned.
* *
* Returns: the byte string contained within the attribute or %NULL. * Returns: the byte string contained within the attribute or %NULL.
**/ */
const char * const char *
_g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr) _g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr)
{ {
@ -490,14 +490,14 @@ _g_file_attribute_value_get_byte_string (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_boolean: * _g_file_attribute_value_get_boolean:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the boolean value from a file attribute value. If the value is not the * Gets the boolean value from a file attribute value. If the value is not the
* right type then %FALSE will be returned. * right type then %FALSE will be returned.
* *
* Returns: the boolean value contained within the attribute, or %FALSE. * Returns: the boolean value contained within the attribute, or %FALSE.
**/ */
gboolean gboolean
_g_file_attribute_value_get_boolean (const GFileAttributeValue *attr) _g_file_attribute_value_get_boolean (const GFileAttributeValue *attr)
{ {
@ -510,14 +510,14 @@ _g_file_attribute_value_get_boolean (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_uint32: * _g_file_attribute_value_get_uint32:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the unsigned 32-bit integer from a file attribute value. If the value * Gets the unsigned 32-bit integer from a file attribute value. If the value
* is not the right type then %0 will be returned. * is not the right type then 0 will be returned.
* *
* Returns: the unsigned 32-bit integer from the attribute, or %0. * Returns: the unsigned 32-bit integer from the attribute, or 0.
**/ */
guint32 guint32
_g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr) _g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr)
{ {
@ -530,14 +530,14 @@ _g_file_attribute_value_get_uint32 (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_int32: * _g_file_attribute_value_get_int32:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the signed 32-bit integer from a file attribute value. If the value * Gets the signed 32-bit integer from a file attribute value. If the value
* is not the right type then %0 will be returned. * is not the right type then 0 will be returned.
* *
* Returns: the signed 32-bit integer from the attribute, or %0. * Returns: the signed 32-bit integer from the attribute, or 0.
**/ */
gint32 gint32
_g_file_attribute_value_get_int32 (const GFileAttributeValue *attr) _g_file_attribute_value_get_int32 (const GFileAttributeValue *attr)
{ {
@ -550,14 +550,14 @@ _g_file_attribute_value_get_int32 (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_uint64: * _g_file_attribute_value_get_uint64:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the unsigned 64-bit integer from a file attribute value. If the value * Gets the unsigned 64-bit integer from a file attribute value. If the value
* is not the right type then %0 will be returned. * is not the right type then 0 will be returned.
* *
* Returns: the unsigned 64-bit integer from the attribute, or %0. * Returns: the unsigned 64-bit integer from the attribute, or 0.
**/ */
guint64 guint64
_g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr) _g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr)
{ {
@ -570,14 +570,14 @@ _g_file_attribute_value_get_uint64 (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_int64: * _g_file_attribute_value_get_int64:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the signed 64-bit integer from a file attribute value. If the value * Gets the signed 64-bit integer from a file attribute value. If the value
* is not the right type then %0 will be returned. * is not the right type then 0 will be returned.
* *
* Returns: the signed 64-bit integer from the attribute, or %0. * Returns: the signed 64-bit integer from the attribute, or 0.
**/ */
gint64 gint64
_g_file_attribute_value_get_int64 (const GFileAttributeValue *attr) _g_file_attribute_value_get_int64 (const GFileAttributeValue *attr)
{ {
@ -590,13 +590,13 @@ _g_file_attribute_value_get_int64 (const GFileAttributeValue *attr)
} }
/* /*
* g_file_attribute_value_get_object: * _g_file_attribute_value_get_object:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* *
* Gets the GObject from a file attribute value. If the value * Gets the GObject from a file attribute value. If the value
* is not the right type then %NULL will be returned. * is not the right type then %NULL will be returned.
* *
* Returns: the GObject from the attribute, or %0. * Returns: the GObject from the attribute, or %NULL.
**/ **/
GObject * GObject *
_g_file_attribute_value_get_object (const GFileAttributeValue *attr) _g_file_attribute_value_get_object (const GFileAttributeValue *attr)
@ -661,13 +661,12 @@ _g_file_attribute_value_set_from_pointer (GFileAttributeValue *value,
} }
/* /*
* g_file_attribute_value_set_string: * _g_file_attribute_value_set_string:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @string: a string to set within the type. * @string: a string to set within the type.
* *
* Sets the attribute value to a given string. * Sets the attribute value to a given string.
* */
**/
void void
_g_file_attribute_value_set_string (GFileAttributeValue *attr, _g_file_attribute_value_set_string (GFileAttributeValue *attr,
const char *string) const char *string)
@ -681,13 +680,12 @@ _g_file_attribute_value_set_string (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_byte_string: * _g_file_attribute_value_set_byte_string:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @string: a byte string to set within the type. * @string: a byte string to set within the type.
* *
* Sets the attribute value to a given byte string. * Sets the attribute value to a given byte string.
* */
**/
void void
_g_file_attribute_value_set_byte_string (GFileAttributeValue *attr, _g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
const char *string) const char *string)
@ -701,13 +699,12 @@ _g_file_attribute_value_set_byte_string (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_boolean: * _g_file_attribute_value_set_boolean:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @value: a #gboolean to set within the type. * @value: a #gboolean to set within the type.
* *
* Sets the attribute value to the given boolean value. * Sets the attribute value to the given boolean value.
* */
**/
void void
_g_file_attribute_value_set_boolean (GFileAttributeValue *attr, _g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
gboolean value) gboolean value)
@ -720,13 +717,12 @@ _g_file_attribute_value_set_boolean (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_uint32: * _g_file_attribute_value_set_uint32:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @value: a #guint32 to set within the type. * @value: a #guint32 to set within the type.
* *
* Sets the attribute value to the given unsigned 32-bit integer. * Sets the attribute value to the given unsigned 32-bit integer.
* */
**/
void void
_g_file_attribute_value_set_uint32 (GFileAttributeValue *attr, _g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
guint32 value) guint32 value)
@ -739,13 +735,12 @@ _g_file_attribute_value_set_uint32 (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_int32: * _g_file_attribute_value_set_int32:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @value: a #gint32 to set within the type. * @value: a #gint32 to set within the type.
* *
* Sets the attribute value to the given signed 32-bit integer. * Sets the attribute value to the given signed 32-bit integer.
* */
**/
void void
_g_file_attribute_value_set_int32 (GFileAttributeValue *attr, _g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
gint32 value) gint32 value)
@ -758,13 +753,12 @@ _g_file_attribute_value_set_int32 (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_uint64: * _g_file_attribute_value_set_uint64:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @value: a #guint64 to set within the type. * @value: a #guint64 to set within the type.
* *
* Sets the attribute value to a given unsigned 64-bit integer. * Sets the attribute value to a given unsigned 64-bit integer.
* */
**/
void void
_g_file_attribute_value_set_uint64 (GFileAttributeValue *attr, _g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
guint64 value) guint64 value)
@ -777,13 +771,12 @@ _g_file_attribute_value_set_uint64 (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_int64: * _g_file_attribute_value_set_int64:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @value: a #gint64 to set within the type. * @value: a #gint64 to set within the type.
* *
* Sets the attribute value to a given signed 64-bit integer. * Sets the attribute value to a given signed 64-bit integer.
* */
**/
void void
_g_file_attribute_value_set_int64 (GFileAttributeValue *attr, _g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
gint64 value) gint64 value)
@ -796,14 +789,13 @@ _g_file_attribute_value_set_int64 (GFileAttributeValue *attr,
} }
/* /*
* g_file_attribute_value_set_object: * _g_file_attribute_value_set_object:
* @attr: a #GFileAttributeValue. * @attr: a #GFileAttributeValue.
* @obj: a #GObject. * @obj: a #GObject.
* *
* Sets the attribute to contain the value @obj. * Sets the attribute to contain the value @obj.
* The @attr references the GObject internally. * The @attr references the GObject internally.
* */
**/
void void
_g_file_attribute_value_set_object (GFileAttributeValue *attr, _g_file_attribute_value_set_object (GFileAttributeValue *attr,
GObject *obj) GObject *obj)
@ -835,7 +827,7 @@ list_update_public (GFileAttributeInfoListPriv *priv)
* Creates a new file attribute info list. * Creates a new file attribute info list.
* *
* Returns: a #GFileAttributeInfoList. * Returns: a #GFileAttributeInfoList.
**/ */
GFileAttributeInfoList * GFileAttributeInfoList *
g_file_attribute_info_list_new (void) g_file_attribute_info_list_new (void)
{ {
@ -858,7 +850,7 @@ g_file_attribute_info_list_new (void)
* Makes a duplicate of a file attribute info list. * Makes a duplicate of a file attribute info list.
* *
* Returns: a copy of the given @list. * Returns: a copy of the given @list.
**/ */
GFileAttributeInfoList * GFileAttributeInfoList *
g_file_attribute_info_list_dup (GFileAttributeInfoList *list) g_file_attribute_info_list_dup (GFileAttributeInfoList *list)
{ {
@ -890,7 +882,7 @@ g_file_attribute_info_list_dup (GFileAttributeInfoList *list)
* References a file attribute info list. * References a file attribute info list.
* *
* Returns: #GFileAttributeInfoList or %NULL on error. * Returns: #GFileAttributeInfoList or %NULL on error.
**/ */
GFileAttributeInfoList * GFileAttributeInfoList *
g_file_attribute_info_list_ref (GFileAttributeInfoList *list) g_file_attribute_info_list_ref (GFileAttributeInfoList *list)
{ {
@ -910,7 +902,7 @@ g_file_attribute_info_list_ref (GFileAttributeInfoList *list)
* *
* Removes a reference from the given @list. If the reference count * Removes a reference from the given @list. If the reference count
* falls to zero, the @list is deleted. * falls to zero, the @list is deleted.
**/ */
void void
g_file_attribute_info_list_unref (GFileAttributeInfoList *list) g_file_attribute_info_list_unref (GFileAttributeInfoList *list)
{ {
@ -960,7 +952,7 @@ g_file_attribute_info_list_bsearch (GFileAttributeInfoList *list,
* *
* Returns: a #GFileAttributeInfo for the @name, or %NULL if an * Returns: a #GFileAttributeInfo for the @name, or %NULL if an
* attribute isn't found. * attribute isn't found.
**/ */
const GFileAttributeInfo * const GFileAttributeInfo *
g_file_attribute_info_list_lookup (GFileAttributeInfoList *list, g_file_attribute_info_list_lookup (GFileAttributeInfoList *list,
const char *name) const char *name)
@ -987,7 +979,7 @@ g_file_attribute_info_list_lookup (GFileAttributeInfoList *list,
* *
* Adds a new attribute with @name to the @list, setting * Adds a new attribute with @name to the @list, setting
* its @type and @flags. * its @type and @flags.
**/ */
void void
g_file_attribute_info_list_add (GFileAttributeInfoList *list, g_file_attribute_info_list_add (GFileAttributeInfoList *list,
const char *name, const char *name,