Skip to content

Commit

Permalink
change:core:Remove unused argument from attr_search
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoan committed Jun 1, 2020
1 parent f013cef commit d17fbf8
Show file tree
Hide file tree
Showing 58 changed files with 312 additions and 313 deletions.
2 changes: 1 addition & 1 deletion navit/announcement.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct announcement *
announcement_new(struct attr *parent, struct attr **attrs) {
struct announcement *this_;
struct attr *type_attr;
if (! (type_attr=attr_search(attrs, NULL, attr_name))) {
if (! (type_attr=attr_search(attrs, attr_name))) {
return NULL;
}
this_=g_new0(struct announcement, 1);
Expand Down
3 changes: 1 addition & 2 deletions navit/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,12 @@ char *attr_to_text(struct attr *attr, struct map *map, int pretty) {
* attribute type and returns the first match.
*
* @param attrs Points to the array of attribute pointers to be searched
* @param last Not used
* @param attr_type The attribute type to search for. Generic types (such as
* attr_any or attr_any_xml) are NOT supported.
* @return Pointer to the first matching attribute, or NULL if no match was found.
*/
struct attr *
attr_search(struct attr **attrs, struct attr *last, enum attr_type attr) {
attr_search(struct attr **attrs, enum attr_type attr) {
dbg(lvl_info, "enter attrs=%p", attrs);
while (*attrs) {
dbg(lvl_debug,"*attrs=%p", *attrs);
Expand Down
2 changes: 1 addition & 1 deletion navit/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ char *attr_to_name(enum attr_type attr);
struct attr *attr_new_from_text(const char *name, const char *value);
char *attr_to_text_ext(struct attr *attr, char *sep, enum attr_format fmt, enum attr_format def_fmt, struct map *map);
char *attr_to_text(struct attr *attr, struct map *map, int pretty);
struct attr *attr_search(struct attr **attrs, struct attr *last, enum attr_type attr);
struct attr *attr_search(struct attr **attrs, enum attr_type attr);
int attr_generic_get_attr(struct attr **attrs, struct attr **def_attrs, enum attr_type type, struct attr *attr,
struct attr_iter *iter);
struct attr **attr_generic_set_attr(struct attr **attrs, struct attr *attr);
Expand Down
4 changes: 2 additions & 2 deletions navit/coord.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ struct coord * coord_new(int x, int y) {

struct coord * coord_new_from_attrs(struct attr *parent, struct attr **attrs) {
struct attr *x,*y;
x=attr_search(attrs, NULL, attr_x);
y=attr_search(attrs, NULL, attr_y);
x=attr_search(attrs, attr_x);
y=attr_search(attrs, attr_y);
if (!x || !y)
return NULL;
return coord_new(x->u.num, y->u.num);
Expand Down
8 changes: 4 additions & 4 deletions navit/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ struct debug *
debug_new(struct attr *parent, struct attr **attrs) {
struct attr *name,*dbg_level_attr,*level_attr;
dbg_level level;
name=attr_search(attrs, NULL, attr_name);
dbg_level_attr=attr_search(attrs, NULL, attr_dbg_level);
level_attr=attr_search(attrs, NULL, attr_level);
name=attr_search(attrs, attr_name);
dbg_level_attr=attr_search(attrs, attr_dbg_level);
level_attr=attr_search(attrs, attr_level);
level = parse_dbg_level(dbg_level_attr,level_attr);
#ifdef HAVE_SOCKET
if (!name && level==lvl_unset) {
struct attr *socket_attr=attr_search(attrs, NULL, attr_socket);
struct attr *socket_attr=attr_search(attrs, attr_socket);
char *p,*s;
if (!socket_attr)
return NULL;
Expand Down
16 changes: 8 additions & 8 deletions navit/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int file_request_do(struct file *file, struct attr **options, int connect

if (!options)
return 0;
attr=attr_search(options, NULL, attr_url);
attr=attr_search(options, attr_url);
if (!attr)
return 0;
name=attr->u.str;
Expand All @@ -125,11 +125,11 @@ static int file_request_do(struct file *file, struct attr **options, int connect
char *method="GET";
char *header=NULL;
int persistent=0;
if ((attr=attr_search(options, NULL, attr_http_method)) && attr->u.str)
if ((attr=attr_search(options, attr_http_method)) && attr->u.str)
method=attr->u.str;
if ((attr=attr_search(options, NULL, attr_http_header)) && attr->u.str)
if ((attr=attr_search(options, attr_http_header)) && attr->u.str)
header=attr->u.str;
if ((attr=attr_search(options, NULL, attr_persistent)))
if ((attr=attr_search(options, attr_persistent)))
persistent=attr->u.num;
if (path)
host[path-name-7]='\0';
Expand Down Expand Up @@ -184,14 +184,14 @@ file_create(char *name, struct attr **options) {
struct attr *attr;
int open_flags=O_LARGEFILE|O_BINARY;

if (options && (attr=attr_search(options, NULL, attr_url))) {
if (options && (attr=attr_search(options, attr_url))) {
#ifdef HAVE_SOCKET
file_request_do(file, options, 1);
#endif
} else {
if (options && (attr=attr_search(options, NULL, attr_readwrite)) && attr->u.num) {
if (options && (attr=attr_search(options, attr_readwrite)) && attr->u.num) {
open_flags |= O_RDWR;
if ((attr=attr_search(options, NULL, attr_create)) && attr->u.num)
if ((attr=attr_search(options, attr_create)) && attr->u.num)
open_flags |= O_CREAT|O_TRUNC;
} else
open_flags |= O_RDONLY;
Expand All @@ -210,7 +210,7 @@ file_create(char *name, struct attr **options) {
file->name_id = (long)atom(name);
}
#ifdef CACHE_SIZE
if (!options || !(attr=attr_search(options, NULL, attr_cache)) || attr->u.num)
if (!options || !(attr=attr_search(options, attr_cache)) || attr->u.num)
file->cache=1;
#endif
dbg_assert(file != NULL);
Expand Down
6 changes: 3 additions & 3 deletions navit/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) {
struct graphics_priv * (*graphicstype_new)(struct navit *nav, struct graphics_methods *meth, struct attr **attrs,
struct callback_list *cbl);

if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
if (! (type_attr=attr_search(attrs, attr_type))) {
dbg(lvl_error,"Graphics plugin type is not set.");
return NULL;
}
Expand All @@ -364,8 +364,8 @@ struct graphics * graphics_new(struct attr *parent, struct attr **attrs) {
this_->font_size=20;
this_->image_cache_hash = g_hash_table_new_full(g_str_hash, g_str_equal,g_free,g_free);
/*get dpi */
virtual_dpi_attr=attr_search(attrs, NULL, attr_virtual_dpi);
real_dpi_attr=attr_search(attrs, NULL, attr_real_dpi);
virtual_dpi_attr=attr_search(attrs, attr_virtual_dpi);
real_dpi_attr=attr_search(attrs, attr_real_dpi);
if(virtual_dpi_attr != NULL) {
navit_float virtual_dpi, real_dpi=0;
virtual_dpi=virtual_dpi_attr->u.num;
Expand Down
6 changes: 3 additions & 3 deletions navit/graphics/android/graphics_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap
ret->padding->right = 0;
ret->padding->bottom = 0;
/* attr_background_color is the background color for system bars (API 17+ only) */
if ((attr=attr_search(attrs, NULL, attr_background_color))) {
if ((attr=attr_search(attrs, attr_background_color))) {
ret->bgcolor = (attr->u.color->a / 0x101) << 24
| (attr->u.color->r / 0x101) << 16
| (attr->u.color->g / 0x101) << 8
Expand All @@ -942,10 +942,10 @@ static struct graphics_priv *graphics_android_new(struct navit *nav, struct grap
/* default is the same as for OSD */
ret->bgcolor = 0xa0000000;
}
if ((attr=attr_search(attrs, NULL, attr_use_camera))) {
if ((attr=attr_search(attrs, attr_use_camera))) {
use_camera=attr->u.num;
}
if ((attr=attr_search(attrs, NULL, attr_callback_list))) {
if ((attr=attr_search(attrs, attr_callback_list))) {
command_add_table(attr->u.callback_list, commands, sizeof(commands)/sizeof(struct command_table), ret);
}
image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal);
Expand Down
8 changes: 4 additions & 4 deletions navit/graphics/egl/graphics_egl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,16 +1254,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph
this->show_overlays = 1;

this->width = SCREEN_WIDTH;
if ((attr = attr_search(attrs, NULL, attr_w)))
if ((attr = attr_search(attrs, attr_w)))
this->width = attr->u.num;
this->height = SCREEN_HEIGHT;
if ((attr = attr_search(attrs, NULL, attr_h)))
if ((attr = attr_search(attrs, attr_h)))
this->height = attr->u.num;
this->timeout = 100;
if ((attr = attr_search(attrs, NULL, attr_timeout)))
if ((attr = attr_search(attrs, attr_timeout)))
this->timeout = attr->u.num;
this->delay = 0;
if ((attr = attr_search(attrs, NULL, attr_delay)))
if ((attr = attr_search(attrs, attr_delay)))
this->delay = attr->u.num;
this->cbl = cbl;

Expand Down
10 changes: 5 additions & 5 deletions navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,18 +1120,18 @@ static struct graphics_priv *graphics_gtk_drawing_area_new(struct navit *nav, st
this->nav = nav;
this->widget=draw;
this->win_w=792;
if ((attr=attr_search(attrs, NULL, attr_w)))
if ((attr=attr_search(attrs, attr_w)))
this->win_w=attr->u.num;
this->win_h=547;
if ((attr=attr_search(attrs, NULL, attr_h)))
if ((attr=attr_search(attrs, attr_h)))
this->win_h=attr->u.num;
this->timeout=100;
if ((attr=attr_search(attrs, NULL, attr_timeout)))
if ((attr=attr_search(attrs, attr_timeout)))
this->timeout=attr->u.num;
this->delay=0;
if ((attr=attr_search(attrs, NULL, attr_delay)))
if ((attr=attr_search(attrs, attr_delay)))
this->delay=attr->u.num;
if ((attr=attr_search(attrs, NULL, attr_window_title)))
if ((attr=attr_search(attrs, attr_window_title)))
this->window_title=g_strdup(attr->u.str);
else
this->window_title=g_strdup("Navit");
Expand Down
2 changes: 1 addition & 1 deletion navit/graphics/null/graphics_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphic
struct attr *event_loop_system = NULL;
*meth=graphics_methods;

event_loop_system = attr_search(attrs, NULL, attr_event_loop_system);
event_loop_system = attr_search(attrs, attr_event_loop_system);

if (event_loop_system && event_loop_system->u.str) {
dbg(lvl_debug, "event_system is %s", event_loop_system->u.str);
Expand Down
8 changes: 4 additions & 4 deletions navit/graphics/opengl/graphics_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1517,16 +1517,16 @@ static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graph
this->overlay_enabled = 1;

this->width = SCREEN_WIDTH;
if ((attr = attr_search(attrs, NULL, attr_w)))
if ((attr = attr_search(attrs, attr_w)))
this->width = attr->u.num;
this->height = SCREEN_HEIGHT;
if ((attr = attr_search(attrs, NULL, attr_h)))
if ((attr = attr_search(attrs, attr_h)))
this->height = attr->u.num;
this->timeout = 100;
if ((attr = attr_search(attrs, NULL, attr_timeout)))
if ((attr = attr_search(attrs, attr_timeout)))
this->timeout = attr->u.num;
this->delay = 0;
if ((attr = attr_search(attrs, NULL, attr_delay)))
if ((attr = attr_search(attrs, attr_delay)))
this->delay = attr->u.num;
this->cbl = cbl;

Expand Down
12 changes: 6 additions & 6 deletions navit/graphics/qt5/graphics_qt5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics
//dbg(lvl_debug,"enter");

/* get qt widget attr */
if ((attr_widget = attr_search(attrs, NULL, attr_qt5_widget))) {
if ((attr_widget = attr_search(attrs, attr_qt5_widget))) {
/* check if we shall use qml */
if (strcmp(attr_widget->u.str, "qwidget") == 0) {
use_qml = false;
Expand All @@ -973,7 +973,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics
*meth = graphics_methods;

/* get event loop from config and request event loop*/
event_loop_system = attr_search(attrs, NULL, attr_event_loop_system);
event_loop_system = attr_search(attrs, attr_event_loop_system);
if (event_loop_system && event_loop_system->u.str) {
//dbg(lvl_debug, "event_system is %s", event_loop_system->u.str);
if (!event_request_system(event_loop_system->u.str, "graphics_qt5"))
Expand Down Expand Up @@ -1002,7 +1002,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics
graphics_priv->argv[graphics_priv->argc] = g_strdup("navit");
graphics_priv->argc++;
/* Get qt platform from config */
if ((platform = attr_search(attrs, NULL, attr_qt5_platform))) {
if ((platform = attr_search(attrs, attr_qt5_platform))) {
graphics_priv->argv[graphics_priv->argc] = g_strdup("-platform");
graphics_priv->argc++;
graphics_priv->argv[graphics_priv->argc] = g_strdup(platform->u.str);
Expand Down Expand Up @@ -1062,7 +1062,7 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics
graphics_priv->widget = new QNavitWidget(graphics_priv, NULL, Qt::Window);
}
#endif
if ((fullscreen = attr_search(attrs, NULL, attr_fullscreen)) && (fullscreen->u.num)) {
if ((fullscreen = attr_search(attrs, attr_fullscreen)) && (fullscreen->u.num)) {
/* show this maximized */
#if USE_QML
if (graphics_priv->window != NULL)
Expand All @@ -1086,10 +1086,10 @@ static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics
geomet = primary->availableGeometry();
}
/* check for height */
if ((h = attr_search(attrs, NULL, attr_h)) && (h->u.num > 100))
if ((h = attr_search(attrs, attr_h)) && (h->u.num > 100))
geomet.setHeight(h->u.num);
/* check for width */
if ((w = attr_search(attrs, NULL, attr_w)) && (w->u.num > 100))
if ((w = attr_search(attrs, attr_w)) && (w->u.num > 100))
geomet.setWidth(w->u.num);
#if USE_QML
if (graphics_priv->window != NULL) {
Expand Down
14 changes: 7 additions & 7 deletions navit/graphics/sdl/graphics_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, st
x_lw_adj = round((float)lw/2.0);
y_lw_adj = 0;
} else {
angle = (M_PI/2.0) - atan(abs(dx)/abs(dy));
angle = (M_PI/2.0) - atan(abs((int)dx)/abs((int)dy));
x_lw_adj = round(sin(angle)*(float)lw/2.0);
y_lw_adj = round(cos(angle)*(float)lw/2.0);
if((x_lw_adj < 0) || (y_lw_adj < 0)) {
Expand Down Expand Up @@ -1359,17 +1359,17 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics
this->video_flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE;
#endif

if ((attr=attr_search(attrs, NULL, attr_w)))
if ((attr=attr_search(attrs, attr_w)))
w=attr->u.num;
if ((attr=attr_search(attrs, NULL, attr_h)))
if ((attr=attr_search(attrs, attr_h)))
h=attr->u.num;
if ((attr=attr_search(attrs, NULL, attr_bpp)))
if ((attr=attr_search(attrs, attr_bpp)))
this->video_bpp=attr->u.num;
if ((attr=attr_search(attrs, NULL, attr_flags))) {
if ((attr=attr_search(attrs, attr_flags))) {
if (attr->u.num & 1)
this->video_flags = SDL_SWSURFACE;
}
if ((attr=attr_search(attrs, NULL, attr_frame))) {
if ((attr=attr_search(attrs, attr_frame))) {
if(!attr->u.num)
this->video_flags |= SDL_NOFRAME;
}
Expand Down Expand Up @@ -1428,7 +1428,7 @@ static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics
this->overlay_enable = 1;

this->aa = 1;
if((attr=attr_search(attrs, NULL, attr_antialias)))
if((attr=attr_search(attrs, attr_antialias)))
this->aa = attr->u.num;

this->resize_callback_initial=1;
Expand Down
10 changes: 5 additions & 5 deletions navit/graphics/win32/graphics_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,19 +1745,19 @@ static struct graphics_priv* graphics_win32_new( struct navit *nav, struct graph
this_=graphics_win32_new_helper(meth);
this_->nav=nav;
this_->frame=1;
if ((attr=attr_search(attrs, NULL, attr_frame)))
if ((attr=attr_search(attrs, attr_frame)))
this_->frame=attr->u.num;
this_->x=0;
if ((attr=attr_search(attrs, NULL, attr_x)))
if ((attr=attr_search(attrs, attr_x)))
this_->x=attr->u.num;
this_->y=0;
if ((attr=attr_search(attrs, NULL, attr_y)))
if ((attr=attr_search(attrs, attr_y)))
this_->y=attr->u.num;
this_->width=792;
if ((attr=attr_search(attrs, NULL, attr_w)))
if ((attr=attr_search(attrs, attr_w)))
this_->width=attr->u.num;
this_->height=547;
if ((attr=attr_search(attrs, NULL, attr_h)))
if ((attr=attr_search(attrs, attr_h)))
this_->height=attr->u.num;
this_->overlays = NULL;
this_->cbl=cbl;
Expand Down
2 changes: 1 addition & 1 deletion navit/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gui_new(struct attr *parent, struct attr **attrs) {
struct attr *type_attr;
struct gui_priv *(*guitype_new)(struct navit *nav, struct gui_methods *meth, struct attr **attrs, struct gui *gui);
struct attr cbl;
if (! (type_attr=attr_search(attrs, NULL, attr_type))) {
if (! (type_attr=attr_search(attrs, attr_type))) {
return NULL;
}

Expand Down
8 changes: 4 additions & 4 deletions navit/gui/gtk/gui_gtk_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,19 +688,19 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth,
this=g_new0(struct gui_priv, 1);
this->nav=nav;

attr = attr_search(attrs, NULL, attr_menubar);
attr = attr_search(attrs, attr_menubar);
if (attr) {
this->menubar_enable=attr->u.num;
} else {
this->menubar_enable=1;
}
attr=attr_search(attrs, NULL, attr_toolbar);
attr=attr_search(attrs, attr_toolbar);
if (attr) {
this->toolbar_enable=attr->u.num;
} else {
this->toolbar_enable=1;
}
attr=attr_search(attrs, NULL, attr_statusbar);
attr=attr_search(attrs, attr_statusbar);
if (attr) {
this->statusbar_enable=attr->u.num;
} else {
Expand Down Expand Up @@ -747,7 +747,7 @@ static struct gui_priv *gui_gtk_new(struct navit *nav, struct gui_methods *meth,

navit_add_callback(nav, callback_new_attr_1(callback_cast(gui_gtk_init), attr_navit, this));

if ((attr=attr_search(attrs, NULL, attr_fullscreen)))
if ((attr=attr_search(attrs, attr_fullscreen)))
fullscreen=attr->u.num;

if (fullscreen) {
Expand Down
Loading

0 comments on commit d17fbf8

Please sign in to comment.