Skip to content

Commit a78da97

Browse files
authored
Merge pull request #922 from DeusData/fix/lint-license-gate
fix(ci): clang-format drift and license-gate false positive from the perf merge
2 parents 617e9c5 + da75d1e commit a78da97

6 files changed

Lines changed: 37 additions & 42 deletions

File tree

src/graph_buffer/graph_buffer.c

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ static void register_node_in_indexes(cbm_gbuf_t *gb, cbm_gbuf_node_t *node) {
344344
}
345345
cbm_gbuf_node_t **grown = realloc(gb->by_id, (size_t)nc * sizeof(*grown));
346346
if (grown) {
347-
memset(grown + gb->by_id_cap, 0,
348-
(size_t)(nc - gb->by_id_cap) * sizeof(*grown));
347+
memset(grown + gb->by_id_cap, 0, (size_t)(nc - gb->by_id_cap) * sizeof(*grown));
349348
gb->by_id = grown;
350349
gb->by_id_cap = nc;
351350
}
@@ -683,11 +682,11 @@ int64_t cbm_gbuf_upsert_node(cbm_gbuf_t *gb, const char *label, const char *name
683682
* function of the colliding entities, not of scheduling. Exactly
684683
* one entity is dropped, as one always was; kind-disambiguated
685684
* QNs (the real cure) are tracked as a follow-up. */
686-
bool same_entity =
687-
existing->label && label && strcmp(existing->label, label) == 0 &&
688-
existing->file_path && file_path && strcmp(existing->file_path, file_path) == 0 &&
689-
existing->start_line == start_line && existing->name && name &&
690-
strcmp(existing->name, name) == 0;
685+
bool same_entity = existing->label && label && strcmp(existing->label, label) == 0 &&
686+
existing->file_path && file_path &&
687+
strcmp(existing->file_path, file_path) == 0 &&
688+
existing->start_line == start_line && existing->name && name &&
689+
strcmp(existing->name, name) == 0;
691690
if (!same_entity) {
692691
int c = strcmp(label ? label : "", existing->label ? existing->label : "");
693692
if (c == 0) {
@@ -717,17 +716,15 @@ int64_t cbm_gbuf_upsert_node(cbm_gbuf_t *gb, const char *label, const char *name
717716
const char *new_label_interned = gb_intern(gb, label);
718717
bool label_changed = !existing->label || !new_label_interned ||
719718
strcmp(existing->label, new_label_interned) != 0;
720-
bool name_changed =
721-
!existing->name || !new_name || strcmp(existing->name, new_name) != 0;
719+
bool name_changed = !existing->name || !new_name || strcmp(existing->name, new_name) != 0;
722720
if (label_changed) {
723721
remove_node_from_ptr_array(
724722
cbm_ht_get(gb->nodes_by_label, existing->label ? existing->label : ""),
725723
existing->id);
726724
}
727725
if (name_changed) {
728726
remove_node_from_ptr_array(
729-
cbm_ht_get(gb->nodes_by_name, existing->name ? existing->name : ""),
730-
existing->id);
727+
cbm_ht_get(gb->nodes_by_name, existing->name ? existing->name : ""), existing->id);
731728
}
732729
existing->label = (char *)new_label_interned;
733730
free(existing->name);
@@ -740,8 +737,8 @@ int64_t cbm_gbuf_upsert_node(cbm_gbuf_t *gb, const char *label, const char *name
740737
existing->properties_json = new_props;
741738
}
742739
if (label_changed) {
743-
node_ptr_array_t *by_label =
744-
get_or_create_node_array(gb->nodes_by_label, existing->label ? existing->label : "");
740+
node_ptr_array_t *by_label = get_or_create_node_array(
741+
gb->nodes_by_label, existing->label ? existing->label : "");
745742
cbm_da_push(by_label, (const cbm_gbuf_node_t *)existing);
746743
}
747744
if (name_changed) {
@@ -1215,12 +1212,11 @@ static void merge_update_existing(cbm_gbuf_t *dst, cbm_gbuf_node_t *existing,
12151212
* (and every downstream consumer) run to run. Same entity → refresh;
12161213
* different entity → keep the lexicographically smallest
12171214
* (label, file_path, start_line, name). */
1218-
bool same_entity =
1219-
existing->label && sn->label && strcmp(existing->label, sn->label) == 0 &&
1220-
existing->file_path && sn->file_path &&
1221-
strcmp(existing->file_path, sn->file_path) == 0 &&
1222-
existing->start_line == sn->start_line && existing->name && sn->name &&
1223-
strcmp(existing->name, sn->name) == 0;
1215+
bool same_entity = existing->label && sn->label &&
1216+
strcmp(existing->label, sn->label) == 0 && existing->file_path &&
1217+
sn->file_path && strcmp(existing->file_path, sn->file_path) == 0 &&
1218+
existing->start_line == sn->start_line && existing->name && sn->name &&
1219+
strcmp(existing->name, sn->name) == 0;
12241220
bool sn_wins = true;
12251221
if (!same_entity) {
12261222
int c = strcmp(sn->label ? sn->label : "", existing->label ? existing->label : "");
@@ -1241,10 +1237,10 @@ static void merge_update_existing(cbm_gbuf_t *dst, cbm_gbuf_node_t *existing,
12411237
* label/name changes (the old code left the node listed under its
12421238
* original label/name, so find_by_label/name mis-listed it). */
12431239
const char *new_label = gb_intern(dst, sn->label);
1244-
bool label_changed = !existing->label || !new_label ||
1245-
strcmp(existing->label, new_label) != 0;
1246-
bool name_changed = !existing->name || !sn->name ||
1247-
strcmp(existing->name, sn->name) != 0;
1240+
bool label_changed =
1241+
!existing->label || !new_label || strcmp(existing->label, new_label) != 0;
1242+
bool name_changed =
1243+
!existing->name || !sn->name || strcmp(existing->name, sn->name) != 0;
12481244
if (label_changed) {
12491245
remove_node_from_ptr_array(
12501246
cbm_ht_get(dst->nodes_by_label, existing->label ? existing->label : ""),

src/pipeline/pass_lsp_cross.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
* — type_rep.h covers the type-representation primitives while
3232
* go_lsp.h was where the project-wide def descriptor landed first. */
3333
#include "lsp/go_lsp.h"
34-
#include "lsp/py_lsp.h" /* cbm_py_build_cross_registry / cbm_run_py_lsp_cross_with_registry */
35-
#include "lsp/c_lsp.h" /* cbm_c_build_cross_registry / cbm_run_c_lsp_cross_with_registry */
36-
#include "lsp/cs_lsp.h" /* cbm_cs_build_cross_registry / cbm_run_cs_lsp_cross_with_registry */
37-
#include "lsp/ts_lsp.h" /* cbm_ts_build_cross_registry / cbm_run_ts_lsp_cross_with_registry */
34+
#include "lsp/py_lsp.h" /* cbm_py_build_cross_registry / cbm_run_py_lsp_cross_with_registry */
35+
#include "lsp/c_lsp.h" /* cbm_c_build_cross_registry / cbm_run_c_lsp_cross_with_registry */
36+
#include "lsp/cs_lsp.h" /* cbm_cs_build_cross_registry / cbm_run_cs_lsp_cross_with_registry */
37+
#include "lsp/ts_lsp.h" /* cbm_ts_build_cross_registry / cbm_run_ts_lsp_cross_with_registry */
3838
#include "lsp/rust_lsp.h" /* cbm_rust_build_cross_registry / cbm_run_rust_lsp_cross_with_registry */
3939
#include "pipeline/pipeline_internal.h"
4040
#include <stdbool.h>

src/pipeline/pass_parallel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,8 @@ static void resolve_worker(int worker_id, void *ctx_ptr) {
28522852
/*result=*/NULL);
28532853
} else {
28542854
cbm_pxc_run_one(lang, result, lsp_source, lsp_source_len, def_module,
2855-
file_defs, file_def_count, imp_keys, imp_vals, imp_count);
2855+
file_defs, file_def_count, imp_keys, imp_vals,
2856+
imp_count);
28562857
}
28572858
} else if (lang == CBM_LANG_JAVASCRIPT || lang == CBM_LANG_TYPESCRIPT ||
28582859
lang == CBM_LANG_TSX) {

src/pipeline/pass_semantic_edges.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,8 +1053,8 @@ static int cmp_deferred_edge_canonical(const void *pa, const void *pb) {
10531053
* and apply the per-node max_edges budget HERE — single-threaded — so the
10541054
* admitted edge set is a pure function of the (canonically sorted) inputs,
10551055
* independent of worker count and scheduling. */
1056-
static int phase6b_merge_edges(cbm_gbuf_t *gbuf, deferred_edge_buf_t *worker_bufs,
1057-
int worker_count, int *edge_counts, int max_edges) {
1056+
static int phase6b_merge_edges(cbm_gbuf_t *gbuf, deferred_edge_buf_t *worker_bufs, int worker_count,
1057+
int *edge_counts, int max_edges) {
10581058
int total_pairs = 0;
10591059
for (int w = 0; w < worker_count; w++) {
10601060
total_pairs += worker_bufs[w].count;
@@ -1335,8 +1335,7 @@ static void free_token_pool_entry(const char *key, void *value, void *ud) {
13351335
/* all_tokens slots BORROW their strings from the per-worker intern pools;
13361336
* the pools own exactly one copy per unique token per worker. */
13371337
static void free_funcs_and_tokens(cbm_sem_func_t *funcs, int func_count, char **all_tokens,
1338-
const int *token_counts, CBMHashTable **pools,
1339-
int worker_count) {
1338+
const int *token_counts, CBMHashTable **pools, int worker_count) {
13401339
(void)token_counts;
13411340
for (int f = 0; f < func_count; f++) {
13421341
free(funcs[f].tfidf_indices);
@@ -1410,7 +1409,6 @@ int cbm_pipeline_pass_semantic_edges(cbm_pipeline_ctx_t *ctx) {
14101409
worker_count);
14111410
CBM_PROF_END_N("semantic_edges", "4_build_and_store_vec", t_phase4, func_count);
14121411

1413-
14141412
cbm_log_info("pass.semantic.vectors_stored", "count", itoa_log(func_count));
14151413

14161414
/* Phase 5: LSH hyperplanes → signatures → buckets. */
@@ -1432,8 +1430,7 @@ int cbm_pipeline_pass_semantic_edges(cbm_pipeline_ctx_t *ctx) {
14321430
free_lsh_buckets(band_buckets);
14331431
free(signatures);
14341432
cbm_log_info("pass.done", "pass", "semantic_edges", "edges", itoa_log(total_edges));
1435-
free_funcs_and_tokens(funcs, func_count, all_tokens, token_counts, token_pools,
1436-
worker_count);
1433+
free_funcs_and_tokens(funcs, func_count, all_tokens, token_counts, token_pools, worker_count);
14371434
free(token_counts);
14381435
cbm_sem_corpus_free(corpus);
14391436
CBM_PROF_END("semantic_edges", "7_cleanup", t_phase7);

src/pipeline/pass_similarity.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ static void sim_query_worker(int worker_id, void *ctx_ptr) {
230230
* assigned in parallel-merge order and vary run to run, which
231231
* flipped which side owned a pair and (with the per-source edge
232232
* cap) flickered the emitted set (determinism). */
233-
if (!src->qn || !cand->qualified_name ||
234-
strcmp(src->qn, cand->qualified_name) >= 0) {
233+
if (!src->qn || !cand->qualified_name || strcmp(src->qn, cand->qualified_name) >= 0) {
235234
continue;
236235
}
237236

src/semantic/rotsq.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
*
44
* Implements the core of Extended RaBitQ (Gao et al., SIGMOD 2024/2025;
55
* arXiv:2405.12497, arXiv:2409.09913) without the reference library (which is
6-
* C++ and bundles Eigen/MPL-2.0). Named rotsq, not rabitq: this is the
6+
* C++ and bundles the Eigen linear-algebra dependency; nothing here is vendored
7+
* or derived from it — this file is written from the papers). Named rotsq, not
8+
* rabitq: this is the
79
* FAMILY core (randomized rotation + per-vector scalar quantization + exact
810
* code-expansion estimator), not the papers' exact codebook construction —
911
* the name should not overclaim fidelity. Rotate each vector with a deterministic
@@ -34,10 +36,10 @@
3436
#include <stdint.h>
3537

3638
enum {
37-
CBM_RSQ_IN_DIM = 768, /* input dimension (CBM_SEM_DIM) */
38-
CBM_RSQ_DIM = 1024, /* padded pow2 rotation dimension */
39-
CBM_RSQ_BITS = 4, /* bits per coordinate */
40-
CBM_RSQ_LEVELS = 15, /* (1 << CBM_RSQ_BITS) - 1 */
39+
CBM_RSQ_IN_DIM = 768, /* input dimension (CBM_SEM_DIM) */
40+
CBM_RSQ_DIM = 1024, /* padded pow2 rotation dimension */
41+
CBM_RSQ_BITS = 4, /* bits per coordinate */
42+
CBM_RSQ_LEVELS = 15, /* (1 << CBM_RSQ_BITS) - 1 */
4143
CBM_RSQ_CODE_BYTES = CBM_RSQ_DIM / 2, /* two 4-bit codes per byte */
4244
};
4345

0 commit comments

Comments
 (0)