* declare variables at the beginning of the block

* minor formatting


SVN revision: 47383
This commit is contained in:
Vincent Torri 2010-03-23 05:45:35 +00:00
parent 9570d2124c
commit 8358354e09
1 changed files with 10 additions and 8 deletions

View File

@ -293,6 +293,7 @@ eina_strbuf_free(Eina_Strbuf *buf)
{
EINA_MAGIC_CHECK_STRBUF(buf);
EINA_MAGIC_SET(buf, EINA_MAGIC_NONE);
free(buf->buf);
free(buf);
}
@ -708,6 +709,7 @@ EAPI char *
eina_strbuf_string_steal(Eina_Strbuf *buf)
{
char *ret;
EINA_MAGIC_CHECK_STRBUF(buf, NULL);
ret = buf->buf;
@ -747,14 +749,14 @@ eina_strbuf_length_get(const Eina_Strbuf *buf)
EAPI Eina_Bool
eina_strbuf_replace(Eina_Strbuf *buf, const char *str, const char *with, unsigned int n)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(with, EINA_FALSE);
EINA_MAGIC_CHECK_STRBUF(buf, 0);
size_t len1, len2;
char *spos;
size_t pos;
EINA_SAFETY_ON_NULL_RETURN_VAL(str, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(with, EINA_FALSE);
EINA_MAGIC_CHECK_STRBUF(buf, 0);
if (n == 0)
return EINA_FALSE;
@ -802,10 +804,6 @@ eina_strbuf_replace(Eina_Strbuf *buf, const char *str, const char *with, unsigne
EAPI int
eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *with)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(str, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(with, 0);
EINA_MAGIC_CHECK_STRBUF(buf, 0);
size_t len1, len2, len;
char *tmp_buf = NULL;
char *spos;
@ -813,6 +811,10 @@ eina_strbuf_replace_all(Eina_Strbuf *buf, const char *str, const char *with)
size_t pos_tmp, start_tmp;
int n = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(str, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(with, 0);
EINA_MAGIC_CHECK_STRBUF(buf, 0);
spos = strstr(buf->buf, str);
if (!spos || *spos == '\0')
return 0;