[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12535 - Extractor/src/plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12535 - Extractor/src/plugins |
Date: |
Sat, 14 Aug 2010 22:20:57 +0200 |
Author: grothoff
Date: 2010-08-14 22:20:57 +0200 (Sat, 14 Aug 2010)
New Revision: 12535
Modified:
Extractor/src/plugins/dvi_extractor.c
Log:
avoid malloc and strlen
Modified: Extractor/src/plugins/dvi_extractor.c
===================================================================
--- Extractor/src/plugins/dvi_extractor.c 2010-08-14 20:16:56 UTC (rev
12534)
+++ Extractor/src/plugins/dvi_extractor.c 2010-08-14 20:20:57 UTC (rev
12535)
@@ -46,7 +46,6 @@
size_t slen;
size_t end;
int i;
- char *value;
end = pos + len;
slen = strlen ("ps:SDict begin [");
@@ -70,24 +69,21 @@
while ((slen < end) && (data[slen] != ')'))
slen++;
slen = slen - pos;
- value = malloc (slen + 1);
- if (value != NULL)
- {
- value[slen] = '\0';
- memcpy (value, &data[pos], slen);
- if (0 != proc (proc_cls,
- "dvi",
- tmap[i].type,
- EXTRACTOR_METAFORMAT_C_STRING,
- "text/plain",
- value,
- strlen (value) +1))
- {
- free (value);
- return 1;
- }
- free (value);
- }
+ {
+ char value[slen + 1];
+ value[slen] = '\0';
+ memcpy (value, &data[pos], slen);
+ if (0 != proc (proc_cls,
+ "dvi",
+ tmap[i].type,
+ EXTRACTOR_METAFORMAT_C_STRING,
+ "text/plain",
+ value,
+ slen +1))
+ {
+ return 1;
+ }
+ }
pos += slen + 1;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12535 - Extractor/src/plugins,
gnunet <=