(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-http.c) |
| |
| 1833 | | | () |
| 1834 | | | { |
| 1835 | | | hf_register_info* hf = NULL; |
| 1836 | | | gint* hf_id = NULL; |
| 1837 | | | guint i = 0; |
| 1838 | | | gchar* ; |
| 1839 | | | GPtrArray* array; |
| 1840 | | | guint new_entries = 0; |
| 1841 | | | * tmp_hdr = NULL; |
| 1842 | | | |
| 1843 | | | if (!) { |
| 1844 | | | = g_hash_table_new(g_str_hash, g_str_equal); |
| 1845 | | | } |
| 1846 | | | |
| 1847 | | | if () { |
| 1848 | | | array = g_ptr_array_new(); |
| 1849 | | | |
| 1850 | | | |
| 1851 | | | |
| 1852 | | | |
| 1853 | | | |
| 1854 | | | |
| 1855 | | | |
| 1856 | | | |
| 1857 | | | |
| 1858 | | | |
| 1859 | | | |
| 1860 | | | |
| 1861 | | | |
| 1862 | | | |
| 1863 | | | |
| 1864 | | | for (i = 0; i < ; i++) { |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 1865 | | | if ((g_hash_table_lookup(, [i].)) == NULL) { |
| 1866 | | | new_entries++; |
| 1867 | | | g_ptr_array_add(array, &[i]); |
| 1868 | | | } |
| 1869 | | | } |
| 1870 | | | |
| 1871 | | | if (new_entries) { |
| 1872 | | | hf = g_malloc0(sizeof(hf_register_info) * new_entries); |
| 1873 | | | for (i = 0; i < new_entries; i++) { |
| 1874 | | | tmp_hdr = (*) g_ptr_array_index(array, i);
x /usr/include/glib-2.0/glib/garray.h |
| |
111 | #define g_ptr_array_index(array,index_) ((array)->pdata)[index_] |
| |
|
| 1875 | | | hf_id = g_malloc(sizeof(gint)); |
| 1876 | | | *hf_id = -1; |
| 1877 | | | = g_strdup(tmp_hdr->); |
| 1878 | | | |
| 1879 | | | hf[i].p_id = hf_id; |
| 1880 | | | hf[i].hfinfo.name = ; |
| 1881 | | | hf[i].hfinfo.abbrev = g_strdup_printf("http..%s", ); |
| 1882 | | | hf[i].hfinfo.type = FT_STRING; |
| 1883 | | | hf[i].hfinfo.display = BASE_NONE; |
| 1884 | | | hf[i].hfinfo.strings = NULL; |
| 1885 | | | hf[i].hfinfo.blurb = g_strdup(tmp_hdr->); |
| 1886 | | | hf[i].hfinfo.same_name_prev = NULL; |
| 1887 | | | hf[i].hfinfo.same_name_next = NULL; |
| 1888 | | | |
| 1889 | | | g_hash_table_insert(, , hf_id); |
| 1890 | | | } |
| 1891 | | | |
| 1892 | | | proto_register_field_array(proto_http, hf, ); |
| 1893 | | | } |
| 1894 | | | } |
| 1895 | | | } |
| |