Hi Andreas,
I think there is a lot of code duplication that should be fixed, like,
what I'm quiting below.
There are also the repeated blocks of "codec->* = 0" that should be
moved into a function. Please try to avoid copy+paste style code.
Regards,
Harald
On Thu, Dec 05, 2013 at 04:02:36PM +0100, Andreas Eversberg wrote:
> @@ -629,6 +629,17 @@ static void config_write_bts_single(struct vty *vty,
> struct gsm_bts *bts)
> }
> }
>
> + vty_out(vty, " codec-support fr");
> + if (bts->codec.hr)
> + vty_out(vty, " hr");
> + if (bts->codec.efr)
> + vty_out(vty, " efr");
> + if (bts->codec.afs)
> + vty_out(vty, " afs");
> + if (bts->codec.ahs)
> + vty_out(vty, " ahs");
> + vty_out(vty, "%s", VTY_NEWLINE);
> +
> + for (i = 0; i < 1; i++) {
> + if (!strcmp(argv[i], "hr"))
> + codec->hr = 1;
> + if (!strcmp(argv[i], "efr"))
> + codec->efr = 1;
> + if (!strcmp(argv[i], "afs"))
> + codec->afs = 1;
> + if (!strcmp(argv[i], "ahs"))
> + codec->ahs = 1;
> + }
> + for (i = 0; i < 2; i++) {
> + if (!strcmp(argv[i], "hr"))
> + codec->hr = 1;
> + if (!strcmp(argv[i], "efr"))
> + codec->efr = 1;
> + if (!strcmp(argv[i], "afs"))
> + codec->afs = 1;
> + if (!strcmp(argv[i], "ahs"))
> + codec->ahs = 1;
> + }
> + for (i = 0; i < 3; i++) {
> + if (!strcmp(argv[i], "hr"))
> + codec->hr = 1;
> + if (!strcmp(argv[i], "efr"))
> + codec->efr = 1;
> + if (!strcmp(argv[i], "afs"))
> + codec->afs = 1;
> + if (!strcmp(argv[i], "ahs"))
> + codec->ahs = 1;
> + }
> + for (i = 0; i < 4; i++) {
> + if (!strcmp(argv[i], "hr"))
> + codec->hr = 1;
> + if (!strcmp(argv[i], "efr"))
> + codec->efr = 1;
> + if (!strcmp(argv[i], "afs"))
> + codec->afs = 1;
> + if (!strcmp(argv[i], "ahs"))
> + codec->ahs = 1;
> + }
> + for (i = 0; i < 5; i++) {
> + if (!strcmp(argv[i], "hr"))
> + codec->hr = 1;
> + if (!strcmp(argv[i], "efr"))
> + codec->efr = 1;
> + if (!strcmp(argv[i], "afs"))
> + codec->afs = 1;
> + if (!strcmp(argv[i], "ahs"))
> + codec->ahs = 1;
--
- Harald Welte <[email protected]> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)