Date:2011-04-20 13:15:19 (12 years 11 months ago)
Author:Werner Almesberger
Commit:4fa909debc047bb008da9dc8cbe9155ead5feff6
Message:libatrf: renamed driver specification argument from "arg" to "spec"

- tools/include/atrf.h (atrf_open), tools/lib/atrf.c (select_driver,
atrf_open): renamed "arg" argument to "spec"
Files: tools/include/atrf.h (1 diff)
tools/lib/atrf.c (3 diffs)

Change Details

tools/include/atrf.h
3030void *atrf_ben_regs(struct atrf_dsc *dsc); /* hack for atrf-xtal */
3131
3232const char *atrf_default_driver_name(void);
33struct atrf_dsc *atrf_open(const char *arg);
33struct atrf_dsc *atrf_open(const char *spec);
3434void atrf_close(struct atrf_dsc *dsc);
3535
3636int atrf_error(struct atrf_dsc *dsc);
tools/lib/atrf.c
110110}
111111
112112
113static const struct atrf_driver *select_driver(const char *arg,
113static const struct atrf_driver *select_driver(const char *spec,
114114    const char **opt)
115115{
116116    const struct atrf_driver **drv;
...... 
123123    }
124124
125125    *opt = NULL;
126    if (!arg || !strcmp(arg, "default"))
126    if (!spec || !strcmp(spec, "default"))
127127        return *drivers;
128128
129    end = strchr(arg, ':');
129    end = strchr(spec, ':');
130130    if (!end)
131        end = strchr(arg, 0);
132    len = end-arg;
131        end = strchr(spec, 0);
132    len = end-spec;
133133    for (drv = drivers; *drv; drv++)
134        if (!strncmp((*drv)->name, arg, len) &&
134        if (!strncmp((*drv)->name, spec, len) &&
135135            strlen((*drv)->name) == len)
136136            break;
137137    if (!*drv) {
138        fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, arg);
138        fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, spec);
139139        return NULL;
140140    }
141141    if (*end)
...... 
144144}
145145
146146
147struct atrf_dsc *atrf_open(const char *arg)
147struct atrf_dsc *atrf_open(const char *spec)
148148{
149149    struct atrf_dsc *dsc;
150150    const struct atrf_driver *driver;
151151    const char *opt;
152152    void *handle;
153153
154    driver = select_driver(arg, &opt);
154    driver = select_driver(spec, &opt);
155155    if (!driver)
156156        return NULL;
157157    handle = driver->open(opt);

Archive Download the corresponding diff file



interactive