]> git.imager.perl.org - imager.git/blobdiff - io.c
various minor documentation updates and fixes
[imager.git] / io.c
diff --git a/io.c b/io.c
index 16bad644d0cdf2eb0cbae553a80ea76619948d31..186eea42388179fba4358b377ce0458550745662 100644 (file)
--- a/io.c
+++ b/io.c
@@ -190,6 +190,9 @@ myfree_file_line(void *p, char *file, int line) {
   char  *pp = p;
   int match = 0;
   int i;
+
+  if (p == NULL)
+    return;
   
   for(i=0; i<MAXMAL; i++) if (malloc_pointers[i].ptr == p) {
     mm_log((1,"myfree_file_line: pointer %i (%s) freed at %s (%i)\n", i, malloc_pointers[i].comm, file, line));
@@ -221,7 +224,6 @@ void
 
 void
 malloc_state() {
-  printf("malloc_state: not in debug mode\n");
 }
 
 void*
@@ -352,10 +354,14 @@ Modifies *p and *len to indicate the consumed characters.
 This doesn't support the extended UTF8 encoding used by later versions
 of Perl.
 
+This doesn't check that the UTF8 charecter is using the shortest
+possible representation.
+
 =cut
 */
 
-unsigned long i_utf8_advance(char const **p, int *len) {
+unsigned long 
+i_utf8_advance(char const **p, int *len) {
   unsigned char c;
   int i, ci, clen = 0;
   unsigned char codes[3];
@@ -366,6 +372,7 @@ unsigned long i_utf8_advance(char const **p, int *len) {
   for (i = 0; i < sizeof(utf8_sizes)/sizeof(*utf8_sizes); ++i) {
     if ((c & utf8_sizes[i].mask) == utf8_sizes[i].expect) {
       clen = utf8_sizes[i].size;
+      break;
     }
   }
   if (clen == 0 || *len < clen-1) {