Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision 10d73d86dccd2e37130c9ce5830e87c02b042a47)
+++ kernel/generic/src/printf/printf_core.c	(revision b54d2f177d73478c2fc4d1d122eddfecc7393b6d)
@@ -258,5 +258,5 @@
 	if (precision == 0)
 		precision = size;
-	
+
 	count_t counter = 0;
 	width -= precision;
@@ -267,5 +267,5 @@
 		}
 	}
-	
+
 	int retval;
 	size_t bytes = utf8_count_bytes(str, min(size, precision));
@@ -279,5 +279,5 @@
 			counter++;
 	}
-	
+
 	return ((int) counter);
 }
@@ -586,4 +586,5 @@
 {
 	index_t i = 0;  /* Index of the currently processed character from fmt */
+	index_t nxt = 0;
 	index_t j = 0;  /* Index to the first not printed nonformating character */
 	
@@ -592,5 +593,10 @@
 	int retval;           /* Return values from nested functions */
 	
-	while ((uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT)) != 0) {
+	while (true) {
+		i = nxt;
+		uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
+
+		if (uc == '\0') break;
+
 		/* Control character */
 		if (uc == '%') {
@@ -612,6 +618,6 @@
 			
 			do {
-				i++;
-				uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+				i = nxt;
+				uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 				switch (uc) {
 				case '#':
@@ -638,16 +644,19 @@
 			int width = 0;
 			if (isdigit(uc)) {
-				while ((uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT)) != 0) {
+				while (true) {
+					width *= 10;
+					width += uc - '0';
+
+					i = nxt;
+					uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
+					if (uc == '\0')
+						break;
 					if (!isdigit(uc))
 						break;
-					
-					width *= 10;
-					width += uc - '0';
-					i++;
 				}
 			} else if (uc == '*') {
 				/* Get width value from argument list */
-				i++;
-				uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+				i = nxt;
+				uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 				width = (int) va_arg(ap, int);
 				if (width < 0) {
@@ -661,19 +670,22 @@
 			int precision = 0;
 			if (uc == '.') {
-				i++;
-				uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+				i = nxt;
+				uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 				if (isdigit(uc)) {
-					while ((uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT)) != 0) {
+					while (true) {
+						precision *= 10;
+						precision += uc - '0';
+
+						i = nxt;
+						uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
+						if (uc == '\0')
+							break;
 						if (!isdigit(uc))
 							break;
-						
-						precision *= 10;
-						precision += uc - '0';
-						i++;
 					}
-				} else if (fmt[i] == '*') {
+				} else if (uc == '*') {
 					/* Get precision value from the argument list */
-					i++;
-					uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+					i = nxt;
+					uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 					precision = (int) va_arg(ap, int);
 					if (precision < 0) {
@@ -693,9 +705,9 @@
 				/* Char or short */
 				qualifier = PrintfQualifierShort;
-				i++;
-				uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+				i = nxt;
+				uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 				if (uc == 'h') {
-					i++;
-					uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+					i = nxt;
+					uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 					qualifier = PrintfQualifierByte;
 				}
@@ -704,9 +716,9 @@
 				/* Long or long long */
 				qualifier = PrintfQualifierLong;
-				i++;
-				uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+				i = nxt;
+				uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 				if (uc == 'l') {
-					i++;
-					uc = utf8_decode(fmt, &i, UTF8_NO_LIMIT);
+					i = nxt;
+					uc = utf8_decode(fmt, &nxt, UTF8_NO_LIMIT);
 					qualifier = PrintfQualifierLongLong;
 				}
@@ -735,5 +747,5 @@
 				
 				counter += retval;
-				j = i + 1;
+				j = nxt;
 				goto next_char;
 			case 'c':
@@ -749,5 +761,5 @@
 				
 				counter += retval;
-				j = i + 1;
+				j = nxt;
 				goto next_char;
 			
@@ -853,9 +865,8 @@
 			
 			counter += retval;
-			j = i + 1;
+			j = nxt;
 		}
 next_char:
-		
-		i++;
+		;
 	}
 	
