struct _Evas_Textblock_Style
{
- char *style_text;
+ const char *style_text;
char *default_tag;
Evas_Object_Style_Tag *tags;
Eina_List *objects;
/* styles */
/**
* @internal
- * Clears the textblock style passed.
+ * Clears the textblock style passed except for the style_text which is replaced.
* @param ts The ts to be cleared. Must not be NULL.
+ * @param style_text the style's text.
*/
static void
-_style_clear(Evas_Textblock_Style *ts)
+_style_replace(Evas_Textblock_Style *ts, const char *style_text)
{
- if (ts->style_text) free(ts->style_text);
+ eina_stringshare_replace(&ts->style_text, style_text);
if (ts->default_tag) free(ts->default_tag);
while (ts->tags)
{
free(tag->replace);
free(tag);
}
- ts->style_text = NULL;
ts->default_tag = NULL;
ts->tags = NULL;
}
/**
* @internal
+ * Clears the textblock style passed.
+ * @param ts The ts to be cleared. Must not be NULL.
+ */
+static void
+_style_clear(Evas_Textblock_Style *ts)
+{
+ _style_replace(ts, NULL);
+}
+
+/**
+ * @internal
* Searches inside the tags stored in the style for the tag who's
* replacement is s of size replace_len;
* @param ts The ts to be cleared. Must not be NULL.
_evas_textblock_text_node_changed(o, obj, NULL);
}
- _style_clear(ts);
- if (text) ts->style_text = strdup(text);
+ _style_replace(ts, text);
if (ts->style_text)
{
// format MUST be KEY='VALUE'[KEY='VALUE']...
- char *p;
- char *key_start, *key_stop, *val_start, *val_stop;
+ const char *p;
+ const char *key_start, *key_stop, *val_start, *val_stop;
key_start = key_stop = val_start = val_stop = NULL;
p = ts->style_text;