Changeset 88057e3 in mainline
- Timestamp:
- 2012-01-23T16:22:40Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a6240a31
- Parents:
- 9d09d7f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/loc.c
r9d09d7f r88057e3 795 795 sysarg_t **data, size_t *count) 796 796 { 797 service_id_t *ids;798 size_t act_size;799 size_t alloc_size;800 int rc;801 802 797 *data = NULL; 803 act_size = 0; /* silence warning */ 804 805 rc = loc_category_get_ids_once(method, arg1, NULL, 0, 798 *count = 0; 799 800 size_t act_size = 0; 801 int rc = loc_category_get_ids_once(method, arg1, NULL, 0, 806 802 &act_size); 807 803 if (rc != EOK) 808 804 return rc; 809 810 alloc_size = act_size;811 ids = malloc(alloc_size);805 806 size_t alloc_size = act_size; 807 service_id_t *ids = malloc(alloc_size); 812 808 if (ids == NULL) 813 809 return ENOMEM; 814 810 815 811 while (true) { 816 812 rc = loc_category_get_ids_once(method, arg1, ids, alloc_size, … … 818 814 if (rc != EOK) 819 815 return rc; 820 821 if (a ct_size <= alloc_size)816 817 if (alloc_size <= act_size) 822 818 break; 823 824 alloc_size *= 2; 825 free(ids); 826 827 ids = malloc(alloc_size); 819 820 alloc_size = act_size; 821 ids = realloc(ids, alloc_size); 828 822 if (ids == NULL) 829 823 return ENOMEM; 830 824 } 831 825 832 826 *count = act_size / sizeof(category_id_t); 833 827 *data = ids;
Note:
See TracChangeset
for help on using the changeset viewer.