Skip to content

Instantly share code, notes, and snippets.

@codebrainz
Created October 15, 2011 02:11
Show Gist options
  • Select an option

  • Save codebrainz/1288898 to your computer and use it in GitHub Desktop.

Select an option

Save codebrainz/1288898 to your computer and use it in GitHub Desktop.
diff --git a/src/utils.c b/src/utils.c
index cd06641..ff52a13 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -103,6 +103,7 @@ void utils_open_browser(const gchar *uri)
/* taken from anjuta, to determine the EOL mode of the file */
gint utils_get_line_endings(const gchar* buffer, gsize size)
{
+# define MAX_LINES 10
gsize i;
guint cr, lf, crlf, max_mode;
gint mode;
@@ -138,6 +139,8 @@ gint utils_get_line_endings(const gchar* buffer, gsize size)
i++;
}
}
+ if ((lf + cr + crlf) > MAX_LINES)
+ break;
}
/* Vote for the maximum */
@@ -155,6 +158,7 @@ gint utils_get_line_endings(const gchar* buffer, gsize size)
}
return mode;
+# undef MAX_LINES
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment