Mercurial > vim
comparison src/eval.c @ 16872:a836d122231a v8.1.1437
patch 8.1.1437: code to handle callbacks is duplicated
commit https://github.com/vim/vim/commit/3a97bb3f0f8bd118ae23f1c97e55d84ff42eef20
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 1 13:28:35 2019 +0200
patch 8.1.1437: code to handle callbacks is duplicated
Problem: Code to handle callbacks is duplicated.
Solution: Add callback_T and functions to deal with it.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Jun 2019 13:30:07 +0200 |
parents | ce04ebdf26b8 |
children | 586d625e21b4 |
comparison
equal
deleted
inserted
replaced
16871:e5dab34ded73 | 16872:a836d122231a |
---|---|
5918 { | 5918 { |
5919 dtv.v_type = VAR_CHANNEL; | 5919 dtv.v_type = VAR_CHANNEL; |
5920 dtv.vval.v_channel = job->jv_channel; | 5920 dtv.vval.v_channel = job->jv_channel; |
5921 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5921 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5922 } | 5922 } |
5923 if (job->jv_exit_partial != NULL) | 5923 if (job->jv_exit_cb.cb_partial != NULL) |
5924 { | 5924 { |
5925 dtv.v_type = VAR_PARTIAL; | 5925 dtv.v_type = VAR_PARTIAL; |
5926 dtv.vval.v_partial = job->jv_exit_partial; | 5926 dtv.vval.v_partial = job->jv_exit_cb.cb_partial; |
5927 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5927 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5928 } | 5928 } |
5929 } | 5929 } |
5930 } | 5930 } |
5931 else if (tv->v_type == VAR_CHANNEL) | 5931 else if (tv->v_type == VAR_CHANNEL) |
5944 for (jq = ch->ch_part[part].ch_json_head.jq_next; jq != NULL; | 5944 for (jq = ch->ch_part[part].ch_json_head.jq_next; jq != NULL; |
5945 jq = jq->jq_next) | 5945 jq = jq->jq_next) |
5946 set_ref_in_item(jq->jq_value, copyID, ht_stack, list_stack); | 5946 set_ref_in_item(jq->jq_value, copyID, ht_stack, list_stack); |
5947 for (cq = ch->ch_part[part].ch_cb_head.cq_next; cq != NULL; | 5947 for (cq = ch->ch_part[part].ch_cb_head.cq_next; cq != NULL; |
5948 cq = cq->cq_next) | 5948 cq = cq->cq_next) |
5949 if (cq->cq_partial != NULL) | 5949 if (cq->cq_callback.cb_partial != NULL) |
5950 { | 5950 { |
5951 dtv.v_type = VAR_PARTIAL; | 5951 dtv.v_type = VAR_PARTIAL; |
5952 dtv.vval.v_partial = cq->cq_partial; | 5952 dtv.vval.v_partial = cq->cq_callback.cb_partial; |
5953 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5953 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5954 } | 5954 } |
5955 if (ch->ch_part[part].ch_partial != NULL) | 5955 if (ch->ch_part[part].ch_callback.cb_partial != NULL) |
5956 { | 5956 { |
5957 dtv.v_type = VAR_PARTIAL; | 5957 dtv.v_type = VAR_PARTIAL; |
5958 dtv.vval.v_partial = ch->ch_part[part].ch_partial; | 5958 dtv.vval.v_partial = |
5959 ch->ch_part[part].ch_callback.cb_partial; | |
5959 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5960 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5960 } | 5961 } |
5961 } | 5962 } |
5962 if (ch->ch_partial != NULL) | 5963 if (ch->ch_callback.cb_partial != NULL) |
5963 { | 5964 { |
5964 dtv.v_type = VAR_PARTIAL; | 5965 dtv.v_type = VAR_PARTIAL; |
5965 dtv.vval.v_partial = ch->ch_partial; | 5966 dtv.vval.v_partial = ch->ch_callback.cb_partial; |
5966 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5967 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5967 } | 5968 } |
5968 if (ch->ch_close_partial != NULL) | 5969 if (ch->ch_close_cb.cb_partial != NULL) |
5969 { | 5970 { |
5970 dtv.v_type = VAR_PARTIAL; | 5971 dtv.v_type = VAR_PARTIAL; |
5971 dtv.vval.v_partial = ch->ch_close_partial; | 5972 dtv.vval.v_partial = ch->ch_close_cb.cb_partial; |
5972 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); | 5973 set_ref_in_item(&dtv, copyID, ht_stack, list_stack); |
5973 } | 5974 } |
5974 } | 5975 } |
5975 } | 5976 } |
5976 #endif | 5977 #endif |