mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	Minor doc clarification
Spell out that g_utf8_strlen() behaves like strlen() wrt. to termination. Bug 612040.
This commit is contained in:
		
							
								
								
									
										15
									
								
								glib/gutf8.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								glib/gutf8.c
									
									
									
									
									
								
							@@ -215,13 +215,14 @@ g_utf8_prev_char (const gchar *p)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * g_utf8_strlen:
 | 
					 * g_utf8_strlen:
 | 
				
			||||||
 * @p: pointer to the start of a UTF-8 encoded string.
 | 
					 * @p: pointer to the start of a UTF-8 encoded string
 | 
				
			||||||
 * @max: the maximum number of bytes to examine. If @max
 | 
					 * @max: the maximum number of bytes to examine. If @max
 | 
				
			||||||
 *       is less than 0, then the string is assumed to be
 | 
					 *       is less than 0, then the string is assumed to be
 | 
				
			||||||
 *       nul-terminated. If @max is 0, @p will not be examined and 
 | 
					 *       nul-terminated. If @max is 0, @p will not be examined and
 | 
				
			||||||
 *       may be %NULL.
 | 
					 *       may be %NULL.
 | 
				
			||||||
 * 
 | 
					 *
 | 
				
			||||||
 * Returns the length of the string in characters.
 | 
					 * Computes the length of the string in characters, not including
 | 
				
			||||||
 | 
					 * the terminating nul character.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Return value: the length of the string in characters
 | 
					 * Return value: the length of the string in characters
 | 
				
			||||||
 **/
 | 
					 **/
 | 
				
			||||||
@@ -245,13 +246,13 @@ g_utf8_strlen (const gchar *p,
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      if (max == 0 || !*p)
 | 
					      if (max == 0 || !*p)
 | 
				
			||||||
        return 0;
 | 
					        return 0;
 | 
				
			||||||
      
 | 
					
 | 
				
			||||||
      p = g_utf8_next_char (p);          
 | 
					      p = g_utf8_next_char (p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      while (p - start < max && *p)
 | 
					      while (p - start < max && *p)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          ++len;
 | 
					          ++len;
 | 
				
			||||||
          p = g_utf8_next_char (p);          
 | 
					          p = g_utf8_next_char (p);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      /* only do the last len increment if we got a complete
 | 
					      /* only do the last len increment if we got a complete
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user