aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-15 12:27:26 +0200
committerMax Kellermann <max@duempel.org>2008-09-15 12:27:26 +0200
commit6d3b7cdd62d798521d73ac58d57bd67061d64ba5 (patch)
tree196aff7bf983541fd2519ca40b92dbeb7acec8b3 /src/support.c
parent1cd28efa96dbc3d49a43d9b12c5b65d493baf949 (diff)
downloadmpd-6d3b7cdd62d798521d73ac58d57bd67061d64ba5.tar.gz
mpd-6d3b7cdd62d798521d73ac58d57bd67061d64ba5.tar.xz
mpd-6d3b7cdd62d798521d73ac58d57bd67061d64ba5.zip
code style, indent with tabs
Follow the same code style als MPD itself. This patch only fixes parts of the code which are going to be touched in the following bunch of patches, i.e. there will be more "code style" patches in the future.
Diffstat (limited to 'src/support.c')
-rw-r--r--src/support.c82
1 files changed, 38 insertions, 44 deletions
diff --git a/src/support.c b/src/support.c
index 847178d9c..2f3e4fd5d 100644
--- a/src/support.c
+++ b/src/support.c
@@ -110,50 +110,44 @@ strcasestr(const char *haystack, const char *needle)
char *
strscroll(char *str, char *separator, int width, scroll_state_t *st)
{
- gchar *tmp, *buf;
- gsize len, size;
-
- if( st->offset==0 )
- {
- st->offset++;
- return g_strdup(str);
- }
-
- /* create a buffer containing the string and the separator */
- size = strlen(str)+strlen(separator)+1;
- tmp = g_malloc(size);
- g_strlcpy(tmp, str, size);
- g_strlcat(tmp, separator, size);
- len = my_strlen(tmp);
-
- if( st->offset >= len )
- st->offset = 0;
-
- /* create the new scrolled string */
- size = width+1;
- if (g_utf8_validate(tmp, -1, NULL) )
- {
- int ulen;
- buf = g_malloc(size*6);// max length of utf8 char is 6
- g_utf8_strncpy(buf, g_utf8_offset_to_pointer(tmp,st->offset), size);
- if( (ulen = g_utf8_strlen(buf, -1)) < width )
- g_utf8_strncpy(buf+strlen(buf), tmp, size - ulen - 1);
- }
- else
- {
- buf = g_malloc(size);
- g_strlcpy(buf, tmp+st->offset, size);
- if( strlen(buf) < width )
- g_strlcat(buf, tmp, size);
- }
- if( time(NULL)-st->t >= 1 )
- {
- st->t = time(NULL);
- st->offset++;
- }
- g_free(tmp);
- return buf;
-
+ gchar *tmp, *buf;
+ gsize len, size;
+
+ if( st->offset==0 ) {
+ st->offset++;
+ return g_strdup(str);
+ }
+
+ /* create a buffer containing the string and the separator */
+ size = strlen(str)+strlen(separator)+1;
+ tmp = g_malloc(size);
+ g_strlcpy(tmp, str, size);
+ g_strlcat(tmp, separator, size);
+ len = my_strlen(tmp);
+
+ if( st->offset >= len )
+ st->offset = 0;
+
+ /* create the new scrolled string */
+ size = width+1;
+ if (g_utf8_validate(tmp, -1, NULL) ) {
+ int ulen;
+ buf = g_malloc(size*6);// max length of utf8 char is 6
+ g_utf8_strncpy(buf, g_utf8_offset_to_pointer(tmp,st->offset), size);
+ if( (ulen = g_utf8_strlen(buf, -1)) < width )
+ g_utf8_strncpy(buf+strlen(buf), tmp, size - ulen - 1);
+ } else {
+ buf = g_malloc(size);
+ g_strlcpy(buf, tmp+st->offset, size);
+ if (strlen(buf) < width)
+ g_strlcat(buf, tmp, size);
+ }
+ if( time(NULL)-st->t >= 1 ) {
+ st->t = time(NULL);
+ st->offset++;
+ }
+ g_free(tmp);
+ return buf;
}
void