diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2011-12-20 03:10:58 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2011-12-20 03:27:51 -0200 |
commit | 052656f5b3c8a7b88210546f2b34605a4b5e845c (patch) | |
tree | b2d861dad619cf0071a9a8c22cfe3280c4f68332 /libkmod/libkmod-elf.c | |
parent | 3267026e0b18e25a754b7c71956256bd6232258b (diff) | |
download | kmod-052656f5b3c8a7b88210546f2b34605a4b5e845c.tar.gz |
Put blank lines where it's due
See CODING-STYLE for reference
Diffstat (limited to 'libkmod/libkmod-elf.c')
-rw-r--r-- | libkmod/libkmod-elf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 7bd73fc..a341a5e 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -406,6 +406,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * err = kmod_elf_get_section(elf, section, &buf, &size); if (err < 0) return err; + strings = buf; if (strings == NULL || size == 0) return 0; @@ -415,6 +416,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * strings++; size--; } + if (size <= 1) return 0; @@ -427,9 +429,11 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * last = i + 1; continue; } + count++; last = i + 1; } + if (strings[i - 1] != '\0') count++; @@ -440,6 +444,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * a[count] = NULL; itr = (char *)(a + count); last = 0; + for (i = 0, count = 0; i < size; i++) { if (strings[i] == '\0') { size_t slen = i - last; @@ -455,6 +460,7 @@ int kmod_elf_get_strings(const struct kmod_elf *elf, const char *section, char * last = i + 1; } } + if (strings[i - 1] != '\0') { size_t slen = i - last; a[count] = itr; |