summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2012-10-10 15:41:21 +0200
committerVicent Marti <tanoku@gmail.com>2012-10-10 15:41:21 +0200
commit2bb12820b13f3a71342f5a911e1d1a7667105506 (patch)
treed3d48d68cd8dda84e9d2a6cfc28947d8b031098b
parentb6b58da3ffd43bc730174b49f0bb0a5ca3d969a5 (diff)
downloadsundown-myr-2bb12820b13f3a71342f5a911e1d1a7667105506.tar.gz
Better name for the offset args
-rw-r--r--src/autolink.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/autolink.c b/src/autolink.c
index 1a47a8d..b0d2616 100644
--- a/src/autolink.c
+++ b/src/autolink.c
@@ -49,7 +49,7 @@ sd_autolink_issafe(const uint8_t *link, size_t link_len)
}
static size_t
-autolink_delim(uint8_t *data, size_t link_end, size_t offset, size_t size)
+autolink_delim(uint8_t *data, size_t link_end, size_t max_rewind, size_t size)
{
uint8_t cclose, copen = 0;
size_t i;
@@ -163,13 +163,13 @@ sd_autolink__www(
size_t *rewind_p,
struct buf *link,
uint8_t *data,
- size_t offset,
+ size_t max_rewind,
size_t size,
unsigned int flags)
{
size_t link_end;
- if (offset > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
+ if (max_rewind > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
return 0;
if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
@@ -183,7 +183,7 @@ sd_autolink__www(
while (link_end < size && !isspace(data[link_end]))
link_end++;
- link_end = autolink_delim(data, link_end, offset, size);
+ link_end = autolink_delim(data, link_end, max_rewind, size);
if (link_end == 0)
return 0;
@@ -199,14 +199,14 @@ sd_autolink__email(
size_t *rewind_p,
struct buf *link,
uint8_t *data,
- size_t offset,
+ size_t max_rewind,
size_t size,
unsigned int flags)
{
size_t link_end, rewind;
int nb = 0, np = 0;
- for (rewind = 0; rewind < offset; ++rewind) {
+ for (rewind = 0; rewind < max_rewind; ++rewind) {
uint8_t c = data[-rewind - 1];
if (isalnum(c))
@@ -238,7 +238,7 @@ sd_autolink__email(
if (link_end < 2 || nb != 1 || np == 0)
return 0;
- link_end = autolink_delim(data, link_end, offset, size);
+ link_end = autolink_delim(data, link_end, max_rewind, size);
if (link_end == 0)
return 0;
@@ -254,7 +254,7 @@ sd_autolink__url(
size_t *rewind_p,
struct buf *link,
uint8_t *data,
- size_t offset,
+ size_t max_rewind,
size_t size,
unsigned int flags)
{
@@ -263,7 +263,7 @@ sd_autolink__url(
if (size < 4 || data[1] != '/' || data[2] != '/')
return 0;
- while (rewind < offset && isalpha(data[-rewind - 1]))
+ while (rewind < max_rewind && isalpha(data[-rewind - 1]))
rewind++;
if (!sd_autolink_issafe(data - rewind, size + rewind))
@@ -283,7 +283,7 @@ sd_autolink__url(
while (link_end < size && !isspace(data[link_end]))
link_end++;
- link_end = autolink_delim(data, link_end, offset, size);
+ link_end = autolink_delim(data, link_end, max_rewind, size);
if (link_end == 0)
return 0;