Skip to content

Commit

Permalink
utils/pdbt: removed trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Nov 13, 2023
1 parent a7b5d55 commit 892c21d
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions utils/pdbt/carrier.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -78,21 +78,21 @@ int load_carrier_names(char *filename) {
idstr[2] = p[3];
p+=5;
len-=5;

id = strtol(idstr, NULL, 10);
if (!IS_VALID_PDB_CARRIERID(id)) {
LWARNING("invalid carrier id '%s'\n", idstr);
ret=-1;
goto nextline;
}

cnames[id]=malloc(len+1);
if (cnames[id]==NULL) {
LERR("out of memory (needed %ld bytes)\n", (long int)len);
ret=-1;
exit(-1);
}

strncpy(cnames[id], p, len - 1);
cnames[id][len - 1]=0;

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/carrier.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
6 changes: 3 additions & 3 deletions utils/pdbt/common.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand All @@ -24,7 +24,7 @@



#include <stdint.h>
#include <stdint.h>



Expand Down
14 changes: 7 additions & 7 deletions utils/pdbt/dt.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -267,21 +267,21 @@ int dt_optimize_leaf(struct dt_node_t *root, carrier_t lastcarrier)
if (node->carrier>0) currentcarrier=node->carrier; /* new common carrier id starts at this node */
else currentcarrier=lastcarrier; /* carry over common carrier id */

/*
Nodes with children sharing the same carrier may be generalized into a common node (prefix).
/*
Nodes with children sharing the same carrier may be generalized into a common node (prefix).
Note that the code in the following if-statement is the reason why dt_optimize() calls this function
multiple times.
*/
if ((allcce=dt_allcce(node))) {
/*
generalization requires having an intermediary parent node or a common carrier id between
all children and the current node
all children and the current node
*/
if ((node->carrier == 0) || (node->carrier < 0 && allcce == currentcarrier)) {
currentcarrier=allcce;
node->carrier=currentcarrier;
for(i=0; i<10; i++) {
/*
/*
Negative carrier ids mark children eligible for generalization into a parent
node. Carrier id 0 cannot be used because it could ambiguously refer to an
intermediary parent node, thereby rendering differentiation of such nodes and
Expand Down Expand Up @@ -341,7 +341,7 @@ void dt_optimize(struct dt_node_t *root)
{
int size;
int oldsize = 0;

size=dt_size(root);

/*
Expand Down
6 changes: 3 additions & 3 deletions utils/pdbt/dt.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand All @@ -24,7 +24,7 @@



#include "common.h"
#include "common.h"



Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/dtm.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/dtm.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/log.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/log.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
14 changes: 7 additions & 7 deletions utils/pdbt/pdb_server.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) {

int so;
struct sockaddr_in sa;

while ((opt = getopt(argc, argv, "m:i:p:vhdl:")) != -1) {
switch (opt) {
case 'm':
Expand Down Expand Up @@ -272,13 +272,13 @@ int main(int argc, char *argv[]) {
LERR("cannot initialize backend.\n");
return -1;
}

so = socket(AF_INET, SOCK_DGRAM, 0);
if (so<0) {
LERR("socket() failed with errno=%d (%s)\n", errno, strerror(errno));
return -1;
}

memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(bind_port);
Expand All @@ -287,13 +287,13 @@ int main(int argc, char *argv[]) {
close(so);
return -1;
}

if (bind(so, (struct sockaddr *) &sa, sizeof(sa))<0) {
LERR("bind() failed with errno=%d (%s)\n", errno, strerror(errno));
close(so);
return -1;
}

udp_server(so);
close(so);

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/pdb_server_backend.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
4 changes: 2 additions & 2 deletions utils/pdbt/pdb_server_backend.h
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down
36 changes: 18 additions & 18 deletions utils/pdbt/pdbt.c
Expand Up @@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

Expand Down Expand Up @@ -182,7 +182,7 @@ int import_csv(struct dt_node_t *root, char *filename) {
carrier_str=line;
prefix=strsep(&carrier_str, ";");
if ( carrier_str == NULL ) {
LWARNING("line %ld: no delimiter `;' found, ignoring line.\n", n);
LWARNING("line %ld: no delimiter `;' found, ignoring line.\n", n);
n++;
continue;
}
Expand Down Expand Up @@ -243,9 +243,9 @@ int dt_write_tree_recursor(const struct dt_node_t *node, const int fd, char* num

slen = strlen(number);
if (slen > 0) {

bufsize = slen + 1 + 1 + 3 + 1 + 1; // line buffer (telephone number + colon + white space + carrier ID + newline + \0)
buf = (char *)malloc(bufsize);
buf = (char *)malloc(bufsize);
if (buf == NULL) {
LERR("could not allocate line output buffer of size %d\n", bufsize);
return -1;
Expand Down Expand Up @@ -302,7 +302,7 @@ int dt_write_tree(const struct dt_node_t *root, const char* filename)
LERR("cannot create file '%s'\n", filename);
return -1;
}

if (dt_write_tree_recursor(root, fd, (char *)&number) < 0) {
LERR("writing tree to file '%s' failed\n", filename);
return -1;
Expand Down Expand Up @@ -484,7 +484,7 @@ int query_udp(char *number, int timeout, struct pollfd *pfds, struct sockaddr_in
return -PDB_TIMEOUT;
}
}

/* prepare request */
reqlen = strlen(number) + 1; /* include null termination */
if (reqlen > sizeof(struct pdb_bdy)) {
Expand Down Expand Up @@ -631,16 +631,16 @@ int query_server(char *number, char *comment, void *data) {
if (carrierid<=0) {
LINFO("%s: not_found: comment='%s', result=%d\n", number, comment, carrierid);
if (carrierid < 0) {
result = carrierid;
result = carrierid;
} else {
result = PDB_NOT_IN_PDB;
result = PDB_NOT_IN_PDB;
}
}
else {
LINFO("%s:%ld:%s\n", number, (long int)carrierid, carrierid2name(carrierid));
result = PDB_OK;
}
return result;
return result;
}


Expand Down Expand Up @@ -871,18 +871,18 @@ int main(int argc, char *argv[]) {
exit_status = PDB_USE_ERROR;
}
for (n=optind+1; n<argc; n++) {
int result;
result = query_server(argv[n], "", &sdata);
int result;
result = query_server(argv[n], "", &sdata);
if ( result != 0) {
exit_status = -result;
exit_status = -result;
}
}
}
else {
int result;
int result;
result = file_query(query_file, query_server, &sdata);
if ( result != 0) {
exit_status = -result;
exit_status = -result;
}
}
}
Expand All @@ -892,18 +892,18 @@ int main(int argc, char *argv[]) {
LERR("cannot load '%s'.\n", mmap_file);
exit(PDB_USE_ERROR);
}

if (query_file==NULL) {
LINFO("\nprocessing command line parameters...\n");
for (n=optind+1; n<argc; n++) {
query_mmap(argv[n], "", mroot);
}
}
else {
int result;
int result;
result = file_query(query_file, query_mmap, mroot);
if ( result != 0) {
exit_status = -result;
exit_status = -result;
}
}
}
Expand Down

0 comments on commit 892c21d

Please sign in to comment.