[Git][NTPsec/ntpsec][master] Reduce the scope of some variables
Matt Selsky
gitlab at mg.gitlab.com
Wed Dec 27 06:05:53 UTC 2017
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
b4665e10 by Matt Selsky at 2017-12-27T00:52:42-05:00
Reduce the scope of some variables
- - - - -
2 changed files:
- libntp/assert.c
- libntp/authreadkeys.c
Changes:
=====================================
libntp/assert.c
=====================================
--- a/libntp/assert.c
+++ b/libntp/assert.c
@@ -44,7 +44,7 @@
void
backtrace_log(void) {
- int j, nptrs;
+ int nptrs;
void *buffer[BACKTRACE_MAXFRAME];
char **strings;
@@ -53,7 +53,7 @@ backtrace_log(void) {
msyslog(LOG_ERR, "ERR: Stack trace:\n");
if (strings) {
/* skip trace of this shim function */
- for (j = 1; j < nptrs; j++)
+ for (int j = 1; j < nptrs; j++)
msyslog(LOG_ERR, "ERR: %s\n", strings[j]);
free(strings);
=====================================
libntp/authreadkeys.c
=====================================
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -70,7 +70,6 @@ authreadkeys(
{
FILE *fp;
char *line;
- char *token;
keyid_t keyno;
int keytype;
char buf[512]; /* lots of room for line */
@@ -100,7 +99,7 @@ msyslog(LOG_ERR, "AUTH: authreadkeys: reading %s", file);
* Now read lines from the file, looking for key entries
*/
while ((line = fgets(buf, sizeof buf, fp)) != NULL) {
- token = nexttok(&line);
+ char *token = nexttok(&line);
if (token == NULL)
continue;
@@ -180,16 +179,14 @@ msyslog(LOG_ERR, "AUTH: authreadkeys: reading %s", file);
keys++;
} else {
char hex[] = "0123456789abcdef";
- uint8_t temp;
- char *ptr;
size_t jlim;
jlim = min(len, 2 * sizeof(keystr));
for (j = 0; j < jlim; j++) {
- ptr = strchr(hex, tolower((unsigned char)token[j]));
+ char *ptr = strchr(hex, tolower((unsigned char)token[j]));
if (ptr == NULL)
break; /* abort decoding */
- temp = (uint8_t)(ptr - hex);
+ uint8_t temp = (uint8_t)(ptr - hex);
if (j & 1)
keystr[j / 2] |= temp;
else
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b4665e1084ac7e80995a5e0b726dcd7f28d4bc9a
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b4665e1084ac7e80995a5e0b726dcd7f28d4bc9a
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171227/4e992f62/attachment.html>
More information about the vc
mailing list