"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/i2cbusses.c" between
i2c-tools-4.2.tar.gz and i2c-tools-4.3.tar.gz

About: i2c-tools are an heterogeneous set of I2C tools for Linux (originally part of the lm-sensors package).

i2cbusses.c  (i2c-tools-4.2):i2cbusses.c  (i2c-tools-4.3)
skipping to change at line 132 skipping to change at line 132
new_adapters = realloc(adapters, (n + BUNCH) * sizeof(struct i2c_adap)); new_adapters = realloc(adapters, (n + BUNCH) * sizeof(struct i2c_adap));
if (!new_adapters) { if (!new_adapters) {
free_adapters(adapters); free_adapters(adapters);
return NULL; return NULL;
} }
memset(new_adapters + n, 0, BUNCH * sizeof(struct i2c_adap)); memset(new_adapters + n, 0, BUNCH * sizeof(struct i2c_adap));
return new_adapters; return new_adapters;
} }
static int sort_i2c_busses(const void *a, const void *b)
{
const struct i2c_adap *adap1 = a;
const struct i2c_adap *adap2 = b;
return adap1->nr - adap2->nr;
}
struct i2c_adap *gather_i2c_busses(void) struct i2c_adap *gather_i2c_busses(void)
{ {
char s[120]; char s[120];
struct dirent *de, *dde; struct dirent *de, *dde;
DIR *dir, *ddir; DIR *dir, *ddir;
FILE *f; FILE *f;
char fstype[NAME_MAX], sysfs[NAME_MAX], n[NAME_MAX]; char fstype[NAME_MAX], sysfs[NAME_MAX], n[NAME_MAX];
int foundsysfs = 0; int foundsysfs = 0;
int len, count = 0; int len, count = 0;
struct i2c_adap *adapters; struct i2c_adap *adapters;
skipping to change at line 317 skipping to change at line 325
return NULL; return NULL;
} }
adapters[count].funcs = adap_types[type].funcs; adapters[count].funcs = adap_types[type].funcs;
adapters[count].algo = adap_types[type].algo; adapters[count].algo = adap_types[type].algo;
count++; count++;
} }
} }
closedir(dir); closedir(dir);
done: done:
/* Sort by bus number for convenience */
qsort(adapters, count, sizeof(struct i2c_adap), sort_i2c_busses);
return adapters; return adapters;
} }
static int lookup_i2c_bus_by_name(const char *bus_name) static int lookup_i2c_bus_by_name(const char *bus_name)
{ {
struct i2c_adap *adapters; struct i2c_adap *adapters;
int i, i2cbus = -1; int i, i2cbus = -1;
adapters = gather_i2c_busses(); adapters = gather_i2c_busses();
if (adapters == NULL) { if (adapters == NULL) {
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)